From 6ed3a1b4aaa3d96505142ac4bd2e7eff6e9aab0e Mon Sep 17 00:00:00 2001 From: Nida Malik Date: Fri, 9 May 2025 15:43:07 +0530 Subject: [PATCH 01/14] Add files via upload --- .../Tasks/netchargeFluctuations.cxx | 378 ++++++++++++++---- 1 file changed, 307 insertions(+), 71 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index b927b083066..65172a5f77a 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -1,6 +1,3 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. // // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". @@ -8,7 +5,7 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. - +// // author Nida Malik (nida.malik@cern.ch) // Department of Physics, Aligarh Muslim University, India // to study the net charge fluctuations by observable, #nu_dyn @@ -17,9 +14,24 @@ #include "Framework/runDataProcessing.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/Core/trackUtilities.h" +#include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/TrackSelection.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" +#include "CommonConstants/MathConstants.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Framework/HistogramRegistry.h" +#include "TProfile.h" +#include "TProfile2D.h" using namespace o2; using namespace o2::framework; @@ -27,76 +39,300 @@ using namespace o2::framework::expressions; using namespace std; namespace o2::aod +{ + namespace netCharge { -using MyCollisions = soa::Join; -using MyCollision = MyCollisions::iterator; + DECLARE_SOA_COLUMN(PosCharge, pos_charge, float); + DECLARE_SOA_COLUMN(NegCharge, neg_charge, float); + DECLARE_SOA_COLUMN(PosSqCharge, possq_charge, float); + DECLARE_SOA_COLUMN(NegSqCharge, negsq_charge, float); + DECLARE_SOA_COLUMN(TermpCharge, termp_charge, float); + DECLARE_SOA_COLUMN(TermnCharge, termn_charge, float); + DECLARE_SOA_COLUMN(PosNegCharge, posneg_charge, float); + DECLARE_SOA_COLUMN(Centrality, centrality, float); +} // namespace + DECLARE_SOA_TABLE(NetCharge, "AOD", "NETChargefluct", + netCharge::PosCharge, + netCharge::NegCharge, + netCharge::PosSqCharge, + netCharge::NegSqCharge, + netCharge::TermpCharge, + netCharge::TermnCharge, + netCharge::PosNegCharge, + netCharge::Centrality); + //------------------------------------------------------ + + using MyCollisionsRun2 = soa::Join; + using MyCollisionRun2 = MyCollisionsRun2::iterator; + using MyCollisionsRun3 = soa::Join; + using MyCollisionRun3 = MyCollisionsRun3::iterator; + using MyTracks = soa::Join; + using MyTrack = MyTracks::iterator; + + +}// o2 :: aod -using MyTracks = soa::Join; -using MyTrack = MyTracks::iterator; -} // namespace o2::aod + enum RunType +{ + kRun3 = 0, + kRun2 + }; struct NetchargeFluctuations { - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - void init(o2::framework::InitContext&) - { - AxisSpec vtxZAxis = {100, -20, 20, "Z (cm)"}; - AxisSpec dcaAxis = {1000, -100, 100, "DCA_{xy} (cm)"}; - AxisSpec dcazAxis = {1000, -100, 100, "DCA_{z} (cm)"}; - AxisSpec ptAxis = {40, 0.0, 4.0, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec etaAxis = {30, -1.5, 1.5, "#eta"}; - AxisSpec centAxis = {100, 0., 100., "centrality"}; - AxisSpec multAxis = {2000, 0., 2000., "multiplicity"}; - - histos.add("hVertexZ_bef", "", kTH1F, {vtxZAxis}); - histos.add("hVertexZ_aft", "", kTH1F, {vtxZAxis}); - histos.add("hVertexZ_aft_sel", "", kTH1D, {vtxZAxis}); - histos.add("hDCAxy_bef", "", kTH1D, {dcaAxis}); - histos.add("hDCAxy_aft", "", kTH1D, {dcaAxis}); - histos.add("hDCAz_bef", "", kTH1D, {dcazAxis}); - histos.add("hDCAz_aft", "", kTH1D, {dcazAxis}); - histos.add("hCentrality", "", kTH1D, {centAxis}); - histos.add("hMultiplicity", "", kTH1D, {multAxis}); - histos.add("hEta", "", kTH1F, {etaAxis}); - histos.add("hPt", "", kTH1F, {ptAxis}); - } - - void process(aod::MyCollision const& coll, aod::MyTracks const& inputTracks) - { - histos.fill(HIST("hVertexZ_bef"), coll.posZ()); - - if (std::fabs(coll.posZ()) > 10.f) { - return; - } - histos.fill(HIST("hVertexZ_aft"), coll.posZ()); - - if (!coll.sel7()) { - return; - } - histos.fill(HIST("hVertexZ_aft_sel"), coll.posZ()); - histos.fill(HIST("hCentrality"), coll.centRun2V0M()); - histos.fill(HIST("hMultiplicity"), coll.multFV0M()); - - for (auto const& track : inputTracks) { - if (std::fabs(track.eta()) > 0.8) - continue; - if (!(track.pt() > 0.2 && track.pt() < 2.)) - continue; - - histos.fill(HIST("hDCAxy_bef"), track.dcaXY()); - histos.fill(HIST("hDCAz_bef"), track.dcaZ()); - - if (!track.isGlobalTrack()) - continue; - - histos.fill(HIST("hDCAxy_aft"), track.dcaXY()); - histos.fill(HIST("hDCAz_aft"), track.dcaZ()); - histos.fill(HIST("hPt"), track.pt()); - histos.fill(HIST("hEta"), track.eta()); - } - } -}; + Produces net_charge; + + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Configurables + Configurable cVtxZcut{"cVtx", 10.f, "Vertex Z"}; + Configurable cEtacut{"cEta", 0.8, "Eta cut"}; + Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; + Configurable cPtmaxcut{"cPtmaxcut", 5.0, "Pt max cut"}; + Configurable cDcaXYcut{"cDcaXYcut", 0.12, "DCA XY cut"}; + Configurable cDcaZcut{"cDcaZcut", 0.3, "DCA Z cut"}; + Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; + Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; + Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; + Configurable cITSchicut{"cITSchi2clustercut", 70, "ITS chi2 cluster cut"}; + Configurable cTPCchicut{"cTPCchi2clustercut", 70, "TPC chi2 cluster cut"}; + + // Event selections + Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; //sel8 + Configurable cInt7Trig{"cInt7Trig", false, "kINT7 MB Trigger"}; //kINT7 + Configurable cSel7Trig{"cSel7Trig", false, "Sel7 (V0A + V0C) Selection Run2"};//sel7 + 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 cPileupReject{"cPileupReject", false, "Pileup rejection"}; //pileup + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; //pileup + Configurable cIsGoodITSLayers{"cIsGoodITSLayers", false, "Good ITS Layers All"}; //pileup + + // Initialization + float cent = 0.; float mult = 0.; + void init(o2::framework::InitContext&) { + + const AxisSpec vtxZAxis = {80, -20, 20, "V_{Z} (cm)"}; + const AxisSpec dcaAxis = {250, -0.5, 0.5, "DCA_{xy} (cm)"}; + const AxisSpec dcazAxis = {250, -0.5, 0.5, "DCA_{z} (cm)"}; + const AxisSpec ptAxis = {70, 0.0, 7.0, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec etaAxis = {20, -1., 1., "#eta"}; + const AxisSpec centAxis = {100, 0., 100., "centrality"}; + const AxisSpec multAxis = {200, 0., 10000., "FT0M Amplitude"}; + const AxisSpec TPCChi2Axis = {140, 0., 7., "Chi2"}; + const AxisSpec ITSChi2Axis = {80, 0., 40., "Chi2"}; + const AxisSpec CrossedrowTPCAxis = {160, 0., 160., "TPC Crossed rows"}; + const AxisSpec eventsAxis = {10, 0, 10, ""}; + + // Before cuts + histos.add("hVtxZ_before", "", kTH1F, {vtxZAxis}); + histos.add("hDcaXY_before", "", kTH1F, {dcaAxis}); + histos.add("hDcaZ_before", "", kTH1F, {dcazAxis}); + histos.add("hTPCchi2perCluster_before", "", kTH1D, {TPCChi2Axis}); + histos.add("hITSchi2perCluster_before", "", kTH1D, {ITSChi2Axis}); + histos.add("hTPCCrossedrows_before", "", kTH1D, {CrossedrowTPCAxis}); + histos.add("hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); + histos.add("hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); + + // After cuts + histos.add("hVtxZ_after", "", kTH1F, {vtxZAxis}); + histos.add("hDcaXY_after", "", kTH1F, {dcaAxis}); + histos.add("hDcaZ_after", "", kTH1F, {dcazAxis}); + histos.add("hTPCchi2perCluster_after", "", kTH1D, {TPCChi2Axis}); + histos.add("hITSchi2perCluster_after", "", kTH1D, {ITSChi2Axis}); + histos.add("hTPCCrossedrows_after", "", kTH1D, {CrossedrowTPCAxis}); + histos.add("hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); + histos.add("hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); + histos.add("hEta", "", kTH1F, {etaAxis}); + histos.add("hPt", "", kTH1F, {ptAxis}); + histos.add("hCentrality", "", kTH1F, {centAxis}); + histos.add("hMultiplicity", "", kTH1F, {multAxis}); + + } + + template + bool selCollision(C const& coll) { + if (std::abs(coll.posZ()) > cVtxZcut) { + return false; + } // Reject the collisions with large vertex-z + + if constexpr (run == kRun3) { + cent = coll.centFT0M(); // centrality for run3 + mult = coll.multFT0M(); // multiplicity for run3 + if (cSel8Trig && !coll.sel8()) { + return false; + } // require min bias trigger + } else { + cent = coll.centRun2V0M(); // centrality for run2 + mult = coll.multFV0M(); // multiplicity for run2 + if (cInt7Trig && !coll.alias_bit(kINT7)) { + return false; + } + if (cSel7Trig && !coll.sel7()) { + return false; + } + } + + if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return false; + } + + if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + return false; + } + + if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return false; + } + + if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + + if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { + return false; + } + + return true; // if all checks pass, accept the collision +} + + template + bool selTrack(T const& track) { + if (!track.isGlobalTrack()) { + return false; + } // accept only global tracks + + if (std::fabs(track.dcaXY()) > cDcaXYcut) { + return false; + } + + if (std::fabs(track.dcaZ()) > cDcaZcut) { + return false; + } + + if (std::fabs(track.eta()) >= cEtacut) { + return false; + } + + if (track.pt() <= cPtmincut || track.pt() >= cPtmaxcut) { + return false; + } + + if (track.tpcNClsCrossedRows() < cTPCcrosscut) { + return false; + } + + if (track.itsChi2NCl() > cITSchicut) { + return false; + } + + if (track.tpcChi2NCl() > cTPCchicut) { + return false; + } + + return true; // if all checks pass, accept the collision +} + +template +void calculation(C const& coll, T const& tracks) { + histos.fill(HIST("hVtxZ_before"), coll.posZ()); + + if (!selCollision(coll)) { + return; + } + + histos.fill(HIST("hVtxZ_after"), coll.posZ()); + histos.fill(HIST("hCentrality"), cent); + histos.fill(HIST("hMultiplicity"), mult); + + int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp= 0; + + for (auto track : tracks) { + histos.fill(HIST("hTPCchi2perCluster_before"), track.tpcChi2NCl()); + histos.fill(HIST("hITSchi2perCluster_before"), track.itsChi2NCl()); + histos.fill(HIST("hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); + histos.fill(HIST("hDcaXY_before"), track.dcaXY()); + histos.fill(HIST("hDcaZ_before"), track.dcaZ()); + histos.fill(HIST("hPtDcaXY_before"), track.pt(), track.dcaXY()); + histos.fill(HIST("hPtDcaZ_before"), track.pt(), track.dcaZ()); + + if (!selTrack(track)) { + continue; + } + + histos.fill(HIST("hDcaXY_after"), track.dcaXY()); + histos.fill(HIST("hDcaZ_after"), track.dcaZ()); + histos.fill(HIST("hPt"), track.pt()); + histos.fill(HIST("hEta"), track.eta()); + histos.fill(HIST("hPtDcaXY_after"), track.pt(), track.dcaXY()); + histos.fill(HIST("hPtDcaZ_after"), track.pt(), track.dcaZ()); + histos.fill(HIST("hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); + histos.fill(HIST("hTPCchi2perCluster_after"), track.tpcChi2NCl()); + histos.fill(HIST("hITSchi2perCluster_after"), track.itsChi2NCl()); + + if (track.sign() > 0) { + fpos += 1; + termp = fpos*(fpos -1); + } + if (track.sign() < 0) { + fneg += 1; + termn = fneg*(fneg -1); + } + posneg = fpos*fneg; + net_charge(fpos, fneg, fpos*fpos, fneg*fneg, termp, termn, posneg, cent); + } // tracks + + return; +} + +void processDataRun3(aod::MyCollisionRun3 const& coll, aod::MyTracks const& tracks) { + calculation(coll, tracks); +} + +PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); + +void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) { + calculation(coll, tracks); +} + +PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); + +};//struct + +struct Netcharge_analysis { + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + std::vector>> net; + + void init(o2::framework::InitContext&) { + std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; + AxisSpec centAxis = {centBinning, "centrality"}; + + registry.add("pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + } + + void process(aod::NetCharge::iterator const& event_netcharge) { + registry.get(HIST("pos_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.pos_charge()); + registry.get(HIST("neg_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.neg_charge()); + registry.get(HIST("termp_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.termp_charge()); + registry.get(HIST("termn_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.termn_charge()); + registry.get(HIST("pos_sq_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.possq_charge()); + registry.get(HIST("neg_sq_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.negsq_charge()); + registry.get(HIST("posneg_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.posneg_charge()); + } +}; //struct + + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; + return WorkflowSpec{ + {adaptAnalysisTask(cfgc)}, + {adaptAnalysisTask(cfgc)}, + + }; } + From 4e32fa7fa3d8064b0f40fbbbed8140eaeb14e2f3 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 4 Jun 2025 11:50:23 +0530 Subject: [PATCH 02/14] cfnetcharg --- .../Tasks/netchargeFluctuations.cxx | 436 +++++++++--------- 1 file changed, 220 insertions(+), 216 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 65172a5f77a..1b741a55362 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -39,300 +39,304 @@ using namespace o2::framework::expressions; using namespace std; namespace o2::aod -{ - namespace netCharge { - DECLARE_SOA_COLUMN(PosCharge, pos_charge, float); - DECLARE_SOA_COLUMN(NegCharge, neg_charge, float); - DECLARE_SOA_COLUMN(PosSqCharge, possq_charge, float); - DECLARE_SOA_COLUMN(NegSqCharge, negsq_charge, float); - DECLARE_SOA_COLUMN(TermpCharge, termp_charge, float); - DECLARE_SOA_COLUMN(TermnCharge, termn_charge, float); - DECLARE_SOA_COLUMN(PosNegCharge, posneg_charge, float); - DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace - DECLARE_SOA_TABLE(NetCharge, "AOD", "NETChargefluct", - netCharge::PosCharge, - netCharge::NegCharge, - netCharge::PosSqCharge, - netCharge::NegSqCharge, - netCharge::TermpCharge, - netCharge::TermnCharge, - netCharge::PosNegCharge, - netCharge::Centrality); - //------------------------------------------------------ - - using MyCollisionsRun2 = soa::Join; - using MyCollisionRun2 = MyCollisionsRun2::iterator; - using MyCollisionsRun3 = soa::Join; - using MyCollisionRun3 = MyCollisionsRun3::iterator; - using MyTracks = soa::Join; - using MyTrack = MyTracks::iterator; - - -}// o2 :: aod - - enum RunType +namespace netCharge { - kRun3 = 0, - kRun2 - }; +DECLARE_SOA_COLUMN(PosCharge, pos_charge, float); +DECLARE_SOA_COLUMN(NegCharge, neg_charge, float); +DECLARE_SOA_COLUMN(PosSqCharge, possq_charge, float); +DECLARE_SOA_COLUMN(NegSqCharge, negsq_charge, float); +DECLARE_SOA_COLUMN(TermpCharge, termp_charge, float); +DECLARE_SOA_COLUMN(TermnCharge, termn_charge, float); +DECLARE_SOA_COLUMN(PosNegCharge, posneg_charge, float); +DECLARE_SOA_COLUMN(Centrality, centrality, float); +} // namespace netCharge +DECLARE_SOA_TABLE(NetCharge, "AOD", "NETChargefluct", + netCharge::PosCharge, + netCharge::NegCharge, + netCharge::PosSqCharge, + netCharge::NegSqCharge, + netCharge::TermpCharge, + netCharge::TermnCharge, + netCharge::PosNegCharge, + netCharge::Centrality); +//------------------------------------------------------ + +using MyCollisionsRun2 = soa::Join; +using MyCollisionRun2 = MyCollisionsRun2::iterator; +using MyCollisionsRun3 = soa::Join; +using MyCollisionRun3 = MyCollisionsRun3::iterator; +using MyTracks = soa::Join; +using MyTrack = MyTracks::iterator; + +} // namespace o2::aod + +enum RunType { + kRun3 = 0, + kRun2 +}; struct NetchargeFluctuations { - Produces net_charge; - - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - - // Configurables - Configurable cVtxZcut{"cVtx", 10.f, "Vertex Z"}; - Configurable cEtacut{"cEta", 0.8, "Eta cut"}; - Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; - Configurable cPtmaxcut{"cPtmaxcut", 5.0, "Pt max cut"}; - Configurable cDcaXYcut{"cDcaXYcut", 0.12, "DCA XY cut"}; - Configurable cDcaZcut{"cDcaZcut", 0.3, "DCA Z cut"}; - Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; - Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; - Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; - Configurable cITSchicut{"cITSchi2clustercut", 70, "ITS chi2 cluster cut"}; - Configurable cTPCchicut{"cTPCchi2clustercut", 70, "TPC chi2 cluster cut"}; - - // Event selections - Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; //sel8 - Configurable cInt7Trig{"cInt7Trig", false, "kINT7 MB Trigger"}; //kINT7 - Configurable cSel7Trig{"cSel7Trig", false, "Sel7 (V0A + V0C) Selection Run2"};//sel7 - 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 cPileupReject{"cPileupReject", false, "Pileup rejection"}; //pileup - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; //pileup - Configurable cIsGoodITSLayers{"cIsGoodITSLayers", false, "Good ITS Layers All"}; //pileup - - // Initialization - float cent = 0.; float mult = 0.; - void init(o2::framework::InitContext&) { - - const AxisSpec vtxZAxis = {80, -20, 20, "V_{Z} (cm)"}; - const AxisSpec dcaAxis = {250, -0.5, 0.5, "DCA_{xy} (cm)"}; - const AxisSpec dcazAxis = {250, -0.5, 0.5, "DCA_{z} (cm)"}; - const AxisSpec ptAxis = {70, 0.0, 7.0, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec etaAxis = {20, -1., 1., "#eta"}; - const AxisSpec centAxis = {100, 0., 100., "centrality"}; - const AxisSpec multAxis = {200, 0., 10000., "FT0M Amplitude"}; - const AxisSpec TPCChi2Axis = {140, 0., 7., "Chi2"}; - const AxisSpec ITSChi2Axis = {80, 0., 40., "Chi2"}; - const AxisSpec CrossedrowTPCAxis = {160, 0., 160., "TPC Crossed rows"}; - const AxisSpec eventsAxis = {10, 0, 10, ""}; - - // Before cuts - histos.add("hVtxZ_before", "", kTH1F, {vtxZAxis}); - histos.add("hDcaXY_before", "", kTH1F, {dcaAxis}); - histos.add("hDcaZ_before", "", kTH1F, {dcazAxis}); - histos.add("hTPCchi2perCluster_before", "", kTH1D, {TPCChi2Axis}); - histos.add("hITSchi2perCluster_before", "", kTH1D, {ITSChi2Axis}); - histos.add("hTPCCrossedrows_before", "", kTH1D, {CrossedrowTPCAxis}); - histos.add("hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); - histos.add("hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); - - // After cuts - histos.add("hVtxZ_after", "", kTH1F, {vtxZAxis}); - histos.add("hDcaXY_after", "", kTH1F, {dcaAxis}); - histos.add("hDcaZ_after", "", kTH1F, {dcazAxis}); - histos.add("hTPCchi2perCluster_after", "", kTH1D, {TPCChi2Axis}); - histos.add("hITSchi2perCluster_after", "", kTH1D, {ITSChi2Axis}); - histos.add("hTPCCrossedrows_after", "", kTH1D, {CrossedrowTPCAxis}); - histos.add("hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); - histos.add("hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); - histos.add("hEta", "", kTH1F, {etaAxis}); - histos.add("hPt", "", kTH1F, {ptAxis}); - histos.add("hCentrality", "", kTH1F, {centAxis}); - histos.add("hMultiplicity", "", kTH1F, {multAxis}); - - } - - template - bool selCollision(C const& coll) { + Produces net_charge; + + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Configurables + Configurable cVtxZcut{"cVtx", 10.f, "Vertex Z"}; + Configurable cEtacut{"cEta", 0.8, "Eta cut"}; + Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; + Configurable cPtmaxcut{"cPtmaxcut", 5.0, "Pt max cut"}; + Configurable cDcaXYcut{"cDcaXYcut", 0.12, "DCA XY cut"}; + Configurable cDcaZcut{"cDcaZcut", 0.3, "DCA Z cut"}; + Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; + Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; + Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; + Configurable cITSchicut{"cITSchi2clustercut", 70, "ITS chi2 cluster cut"}; + Configurable cTPCchicut{"cTPCchi2clustercut", 70, "TPC chi2 cluster cut"}; + + // Event selections + Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 + Configurable cInt7Trig{"cInt7Trig", false, "kINT7 MB Trigger"}; // kINT7 + Configurable cSel7Trig{"cSel7Trig", false, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 + 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 cPileupReject{"cPileupReject", false, "Pileup rejection"}; // pileup + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup + Configurable cIsGoodITSLayers{"cIsGoodITSLayers", false, "Good ITS Layers All"}; // pileup + + // Initialization + float cent = 0.; + float mult = 0.; + void init(o2::framework::InitContext&) + { + + const AxisSpec vtxZAxis = {80, -20, 20, "V_{Z} (cm)"}; + const AxisSpec dcaAxis = {250, -0.5, 0.5, "DCA_{xy} (cm)"}; + const AxisSpec dcazAxis = {250, -0.5, 0.5, "DCA_{z} (cm)"}; + const AxisSpec ptAxis = {70, 0.0, 7.0, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec etaAxis = {20, -1., 1., "#eta"}; + const AxisSpec centAxis = {100, 0., 100., "centrality"}; + const AxisSpec multAxis = {200, 0., 10000., "FT0M Amplitude"}; + const AxisSpec TPCChi2Axis = {140, 0., 7., "Chi2"}; + const AxisSpec ITSChi2Axis = {80, 0., 40., "Chi2"}; + const AxisSpec CrossedrowTPCAxis = {160, 0., 160., "TPC Crossed rows"}; + const AxisSpec eventsAxis = {10, 0, 10, ""}; + + // Before cuts + histos.add("hVtxZ_before", "", kTH1F, {vtxZAxis}); + histos.add("hDcaXY_before", "", kTH1F, {dcaAxis}); + histos.add("hDcaZ_before", "", kTH1F, {dcazAxis}); + histos.add("hTPCchi2perCluster_before", "", kTH1D, {TPCChi2Axis}); + histos.add("hITSchi2perCluster_before", "", kTH1D, {ITSChi2Axis}); + histos.add("hTPCCrossedrows_before", "", kTH1D, {CrossedrowTPCAxis}); + histos.add("hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); + histos.add("hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); + + // After cuts + histos.add("hVtxZ_after", "", kTH1F, {vtxZAxis}); + histos.add("hDcaXY_after", "", kTH1F, {dcaAxis}); + histos.add("hDcaZ_after", "", kTH1F, {dcazAxis}); + histos.add("hTPCchi2perCluster_after", "", kTH1D, {TPCChi2Axis}); + histos.add("hITSchi2perCluster_after", "", kTH1D, {ITSChi2Axis}); + histos.add("hTPCCrossedrows_after", "", kTH1D, {CrossedrowTPCAxis}); + histos.add("hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); + histos.add("hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); + histos.add("hEta", "", kTH1F, {etaAxis}); + histos.add("hPt", "", kTH1F, {ptAxis}); + histos.add("hCentrality", "", kTH1F, {centAxis}); + histos.add("hMultiplicity", "", kTH1F, {multAxis}); + } + + template + bool selCollision(C const& coll) + { if (std::abs(coll.posZ()) > cVtxZcut) { - return false; + return false; } // Reject the collisions with large vertex-z if constexpr (run == kRun3) { - cent = coll.centFT0M(); // centrality for run3 - mult = coll.multFT0M(); // multiplicity for run3 - if (cSel8Trig && !coll.sel8()) { - return false; - } // require min bias trigger + cent = coll.centFT0M(); // centrality for run3 + mult = coll.multFT0M(); // multiplicity for run3 + if (cSel8Trig && !coll.sel8()) { + return false; + } // require min bias trigger } else { - cent = coll.centRun2V0M(); // centrality for run2 - mult = coll.multFV0M(); // multiplicity for run2 - if (cInt7Trig && !coll.alias_bit(kINT7)) { - return false; - } - if (cSel7Trig && !coll.sel7()) { - return false; - } + cent = coll.centRun2V0M(); // centrality for run2 + mult = coll.multFV0M(); // multiplicity for run2 + if (cInt7Trig && !coll.alias_bit(kINT7)) { + return false; + } + if (cSel7Trig && !coll.sel7()) { + return false; + } } if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { - return false; + return false; } if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - return false; + return false; } if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { - return false; + return false; } if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - return false; + return false; } if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { - return false; + return false; } return true; // if all checks pass, accept the collision -} - - template - bool selTrack(T const& track) { + } + + template + bool selTrack(T const& track) + { if (!track.isGlobalTrack()) { - return false; + return false; } // accept only global tracks if (std::fabs(track.dcaXY()) > cDcaXYcut) { - return false; + return false; } if (std::fabs(track.dcaZ()) > cDcaZcut) { - return false; + return false; } if (std::fabs(track.eta()) >= cEtacut) { - return false; + return false; } if (track.pt() <= cPtmincut || track.pt() >= cPtmaxcut) { - return false; + return false; } if (track.tpcNClsCrossedRows() < cTPCcrosscut) { - return false; + return false; } if (track.itsChi2NCl() > cITSchicut) { - return false; + return false; } if (track.tpcChi2NCl() > cTPCchicut) { - return false; + return false; } return true; // if all checks pass, accept the collision -} + } -template -void calculation(C const& coll, T const& tracks) { + template + void calculation(C const& coll, T const& tracks) + { histos.fill(HIST("hVtxZ_before"), coll.posZ()); if (!selCollision(coll)) { - return; + return; } histos.fill(HIST("hVtxZ_after"), coll.posZ()); histos.fill(HIST("hCentrality"), cent); histos.fill(HIST("hMultiplicity"), mult); - int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp= 0; + int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; for (auto track : tracks) { - histos.fill(HIST("hTPCchi2perCluster_before"), track.tpcChi2NCl()); - histos.fill(HIST("hITSchi2perCluster_before"), track.itsChi2NCl()); - histos.fill(HIST("hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); - histos.fill(HIST("hDcaXY_before"), track.dcaXY()); - histos.fill(HIST("hDcaZ_before"), track.dcaZ()); - histos.fill(HIST("hPtDcaXY_before"), track.pt(), track.dcaXY()); - histos.fill(HIST("hPtDcaZ_before"), track.pt(), track.dcaZ()); - - if (!selTrack(track)) { - continue; - } - - histos.fill(HIST("hDcaXY_after"), track.dcaXY()); - histos.fill(HIST("hDcaZ_after"), track.dcaZ()); - histos.fill(HIST("hPt"), track.pt()); - histos.fill(HIST("hEta"), track.eta()); - histos.fill(HIST("hPtDcaXY_after"), track.pt(), track.dcaXY()); - histos.fill(HIST("hPtDcaZ_after"), track.pt(), track.dcaZ()); - histos.fill(HIST("hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); - histos.fill(HIST("hTPCchi2perCluster_after"), track.tpcChi2NCl()); - histos.fill(HIST("hITSchi2perCluster_after"), track.itsChi2NCl()); - - if (track.sign() > 0) { - fpos += 1; - termp = fpos*(fpos -1); - } - if (track.sign() < 0) { - fneg += 1; - termn = fneg*(fneg -1); - } - posneg = fpos*fneg; - net_charge(fpos, fneg, fpos*fpos, fneg*fneg, termp, termn, posneg, cent); + histos.fill(HIST("hTPCchi2perCluster_before"), track.tpcChi2NCl()); + histos.fill(HIST("hITSchi2perCluster_before"), track.itsChi2NCl()); + histos.fill(HIST("hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); + histos.fill(HIST("hDcaXY_before"), track.dcaXY()); + histos.fill(HIST("hDcaZ_before"), track.dcaZ()); + histos.fill(HIST("hPtDcaXY_before"), track.pt(), track.dcaXY()); + histos.fill(HIST("hPtDcaZ_before"), track.pt(), track.dcaZ()); + + if (!selTrack(track)) { + continue; + } + + histos.fill(HIST("hDcaXY_after"), track.dcaXY()); + histos.fill(HIST("hDcaZ_after"), track.dcaZ()); + histos.fill(HIST("hPt"), track.pt()); + histos.fill(HIST("hEta"), track.eta()); + histos.fill(HIST("hPtDcaXY_after"), track.pt(), track.dcaXY()); + histos.fill(HIST("hPtDcaZ_after"), track.pt(), track.dcaZ()); + histos.fill(HIST("hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); + histos.fill(HIST("hTPCchi2perCluster_after"), track.tpcChi2NCl()); + histos.fill(HIST("hITSchi2perCluster_after"), track.itsChi2NCl()); + + if (track.sign() > 0) { + fpos += 1; + termp = fpos * (fpos - 1); + } + if (track.sign() < 0) { + fneg += 1; + termn = fneg * (fneg - 1); + } + posneg = fpos * fneg; + net_charge(fpos, fneg, fpos * fpos, fneg * fneg, termp, termn, posneg, cent); } // tracks return; -} - -void processDataRun3(aod::MyCollisionRun3 const& coll, aod::MyTracks const& tracks) { + } + + void processDataRun3(aod::MyCollisionRun3 const& coll, aod::MyTracks const& tracks) + { calculation(coll, tracks); -} + } -PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); -void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) { + void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) + { calculation(coll, tracks); -} + } -PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); - -};//struct + PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); -struct Netcharge_analysis { - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - std::vector>> net; - - void init(o2::framework::InitContext&) { - std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; - AxisSpec centAxis = {centBinning, "centrality"}; - - registry.add("pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - } - - void process(aod::NetCharge::iterator const& event_netcharge) { - registry.get(HIST("pos_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.pos_charge()); - registry.get(HIST("neg_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.neg_charge()); - registry.get(HIST("termp_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.termp_charge()); - registry.get(HIST("termn_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.termn_charge()); - registry.get(HIST("pos_sq_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.possq_charge()); - registry.get(HIST("neg_sq_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.negsq_charge()); - registry.get(HIST("posneg_vs_cent")) ->Fill(event_netcharge.centrality(), event_netcharge.posneg_charge()); - } -}; //struct +}; // struct +struct Netcharge_analysis { + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + std::vector>> net; + + void init(o2::framework::InitContext&) + { + std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; + AxisSpec centAxis = {centBinning, "centrality"}; + + registry.add("pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + } + + void process(aod::NetCharge::iterator const& event_netcharge) + { + registry.get(HIST("pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.pos_charge()); + registry.get(HIST("neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.neg_charge()); + registry.get(HIST("termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termp_charge()); + registry.get(HIST("termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termn_charge()); + registry.get(HIST("pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.possq_charge()); + registry.get(HIST("neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negsq_charge()); + registry.get(HIST("posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posneg_charge()); + } +}; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - {adaptAnalysisTask(cfgc)}, - {adaptAnalysisTask(cfgc)}, + {adaptAnalysisTask(cfgc)}, + {adaptAnalysisTask(cfgc)}, }; } - From 98ded6231f470c517e26b0b56b73551e31845e07 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 4 Jun 2025 11:54:58 +0530 Subject: [PATCH 03/14] cfnetchargfluc --- .../Tasks/netchargeFluctuations.cxx | 432 +++++++++++++++++- 1 file changed, 411 insertions(+), 21 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 1b741a55362..b16ddaddfdf 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -1,4 +1,4 @@ -// +// Copyright CERN 2025 // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". // @@ -6,9 +6,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// author Nida Malik (nida.malik@cern.ch) -// Department of Physics, Aligarh Muslim University, India -// to study the net charge fluctuations by observable, #nu_dyn +// Author: Nida Malik (nida.malik@cern.ch) +// Affiliation: Department of Physics, Aligarh Muslim University, India +// +// Description: Study the net charge fluctuations by observable #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -30,8 +31,10 @@ #include "PWGCF/Core/PairCuts.h" #include "Common/CCDB/TriggerAliases.h" #include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "TProfile.h" #include "TProfile2D.h" +#include "TRandom3.h" using namespace o2; using namespace o2::framework; @@ -51,6 +54,31 @@ DECLARE_SOA_COLUMN(TermnCharge, termn_charge, float); DECLARE_SOA_COLUMN(PosNegCharge, posneg_charge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); } // namespace netCharge + +namespace netChargeRec +{ +DECLARE_SOA_COLUMN(PosCharge, pos_charge, float); +DECLARE_SOA_COLUMN(NegCharge, neg_charge, float); +DECLARE_SOA_COLUMN(PosSqCharge, possq_charge, float); +DECLARE_SOA_COLUMN(NegSqCharge, negsq_charge, float); +DECLARE_SOA_COLUMN(TermpCharge, termp_charge, float); +DECLARE_SOA_COLUMN(TermnCharge, termn_charge, float); +DECLARE_SOA_COLUMN(PosNegCharge, posneg_charge, float); +DECLARE_SOA_COLUMN(Centrality, centrality, float); +} // namespace netChargeRec + +namespace netChargeGen +{ +DECLARE_SOA_COLUMN(PosCharge, pos_charge, float); +DECLARE_SOA_COLUMN(NegCharge, neg_charge, float); +DECLARE_SOA_COLUMN(PosSqCharge, possq_charge, float); +DECLARE_SOA_COLUMN(NegSqCharge, negsq_charge, float); +DECLARE_SOA_COLUMN(TermpCharge, termp_charge, float); +DECLARE_SOA_COLUMN(TermnCharge, termn_charge, float); +DECLARE_SOA_COLUMN(PosNegCharge, posneg_charge, float); +DECLARE_SOA_COLUMN(Centrality, centrality, float); +} // namespace netChargeGen + DECLARE_SOA_TABLE(NetCharge, "AOD", "NETChargefluct", netCharge::PosCharge, netCharge::NegCharge, @@ -60,7 +88,26 @@ DECLARE_SOA_TABLE(NetCharge, "AOD", "NETChargefluct", netCharge::TermnCharge, netCharge::PosNegCharge, netCharge::Centrality); -//------------------------------------------------------ + +DECLARE_SOA_TABLE(NetChargeRec, "AOD", "NETfluctRec", + netChargeRec::PosCharge, + netChargeRec::NegCharge, + netChargeRec::PosSqCharge, + netChargeRec::NegSqCharge, + netChargeRec::TermpCharge, + netChargeRec::TermnCharge, + netChargeRec::PosNegCharge, + netChargeRec::Centrality); + +DECLARE_SOA_TABLE(NetChargeGen, "AOD", "NETfluctGen", + netChargeGen::PosCharge, + netChargeGen::NegCharge, + netChargeGen::PosSqCharge, + netChargeGen::NegSqCharge, + netChargeGen::TermpCharge, + netChargeGen::TermnCharge, + netChargeGen::PosNegCharge, + netChargeGen::Centrality); using MyCollisionsRun2 = soa::Join; using MyCollisionRun2 = MyCollisionsRun2::iterator; @@ -69,6 +116,15 @@ 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 o2::aod enum RunType { @@ -78,6 +134,9 @@ enum RunType { struct NetchargeFluctuations { Produces net_charge; + Produces net_charge_rec; + Produces net_charge_gen; + Service pdg; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -96,8 +155,8 @@ struct NetchargeFluctuations { // Event selections Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 - Configurable cInt7Trig{"cInt7Trig", false, "kINT7 MB Trigger"}; // kINT7 - Configurable cSel7Trig{"cSel7Trig", false, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 + Configurable cInt7Trig{"cInt7Trig", true, "kINT7 MB Trigger"}; // kINT7 + Configurable cSel7Trig{"cSel7Trig", true, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 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 @@ -110,7 +169,6 @@ struct NetchargeFluctuations { float mult = 0.; void init(o2::framework::InitContext&) { - const AxisSpec vtxZAxis = {80, -20, 20, "V_{Z} (cm)"}; const AxisSpec dcaAxis = {250, -0.5, 0.5, "DCA_{xy} (cm)"}; const AxisSpec dcazAxis = {250, -0.5, 0.5, "DCA_{z} (cm)"}; @@ -122,8 +180,8 @@ struct NetchargeFluctuations { const AxisSpec ITSChi2Axis = {80, 0., 40., "Chi2"}; const AxisSpec CrossedrowTPCAxis = {160, 0., 160., "TPC Crossed rows"}; const AxisSpec eventsAxis = {10, 0, 10, ""}; + const AxisSpec signAxis = {20, -10, 10, ""}; - // Before cuts histos.add("hVtxZ_before", "", kTH1F, {vtxZAxis}); histos.add("hDcaXY_before", "", kTH1F, {dcaAxis}); histos.add("hDcaZ_before", "", kTH1F, {dcazAxis}); @@ -132,8 +190,6 @@ struct NetchargeFluctuations { histos.add("hTPCCrossedrows_before", "", kTH1D, {CrossedrowTPCAxis}); histos.add("hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); histos.add("hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); - - // After cuts histos.add("hVtxZ_after", "", kTH1F, {vtxZAxis}); histos.add("hDcaXY_after", "", kTH1F, {dcaAxis}); histos.add("hDcaZ_after", "", kTH1F, {dcazAxis}); @@ -146,6 +202,31 @@ struct NetchargeFluctuations { histos.add("hPt", "", kTH1F, {ptAxis}); histos.add("hCentrality", "", kTH1F, {centAxis}); histos.add("hMultiplicity", "", kTH1F, {multAxis}); + histos.add("rec_hVtxZ_before", "", kTH1F, {vtxZAxis}); + histos.add("gen_hVtxZ_before", "", kTH1F, {vtxZAxis}); + histos.add("rec_hDcaXY_before", "", kTH1D, {dcaAxis}); + histos.add("rec_hDcaZ_before", "", kTH1D, {dcazAxis}); + histos.add("rec_hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {TPCChi2Axis}); + histos.add("rec_hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {ITSChi2Axis}); + histos.add("rec_hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); + histos.add("rec_hVtxZ_after", "", kTH1F, {vtxZAxis}); + histos.add("gen_hVtxZ_after", "", kTH1F, {vtxZAxis}); + histos.add("rec_hDcaXY_after", "", kTH1D, {dcaAxis}); + histos.add("rec_hDcaZ_after", "", kTH1D, {dcazAxis}); + histos.add("rec_hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {TPCChi2Axis}); + histos.add("rec_hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {ITSChi2Axis}); + histos.add("rec_hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); + histos.add("gen_hEta", "", kTH1F, {etaAxis}); + histos.add("rec_hEta", "", kTH1F, {etaAxis}); + histos.add("gen_hSign", "", kTH1F, {signAxis}); + histos.add("gen_hPt", "", kTH1F, {ptAxis}); + histos.add("rec_hPt", "", kTH1F, {ptAxis}); + histos.add("rec_hPtDcaXY_after", "hPtDCAxy", kTH2D, {ptAxis, dcaAxis}); + histos.add("rec_hPtDcaZ_after", "hPtDCAz", kTH2D, {ptAxis, dcazAxis}); + histos.add("rec_hCentrality", "", kTH1D, {centAxis}); + histos.add("gen_hCentrality", "", kTH1D, {centAxis}); + histos.add("rec_hMultiplicity", "", kTH1D, {multAxis}); + histos.add("gen_hMultiplicity", "", kTH1D, {multAxis}); } template @@ -156,20 +237,21 @@ struct NetchargeFluctuations { } // Reject the collisions with large vertex-z if constexpr (run == kRun3) { - cent = coll.centFT0M(); // centrality for run3 - mult = coll.multFT0M(); // multiplicity for run3 + if (cSel8Trig && !coll.sel8()) { return false; } // require min bias trigger + cent = coll.centFT0M(); // centrality for run3 + mult = coll.multFT0M(); // multiplicity for run3 } else { - cent = coll.centRun2V0M(); // centrality for run2 - mult = coll.multFV0M(); // multiplicity for run2 if (cInt7Trig && !coll.alias_bit(kINT7)) { return false; } if (cSel7Trig && !coll.sel7()) { return false; } + cent = coll.centRun2V0M(); // centrality for run2 + mult = coll.multFV0M(); // multiplicity for run2 } if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { @@ -260,7 +342,8 @@ struct NetchargeFluctuations { if (!selTrack(track)) { continue; } - + if (track.sign() == 0) + continue; histos.fill(HIST("hDcaXY_after"), track.dcaXY()); histos.fill(HIST("hDcaZ_after"), track.dcaZ()); histos.fill(HIST("hPt"), track.pt()); @@ -271,14 +354,16 @@ struct NetchargeFluctuations { histos.fill(HIST("hTPCchi2perCluster_after"), track.tpcChi2NCl()); histos.fill(HIST("hITSchi2perCluster_after"), track.itsChi2NCl()); - if (track.sign() > 0) { + if (track.sign() == 1) { fpos += 1; termp = fpos * (fpos - 1); } - if (track.sign() < 0) { + + if (track.sign() == -1) { fneg += 1; termn = fneg * (fneg - 1); } + posneg = fpos * fneg; net_charge(fpos, fneg, fpos * fpos, fneg * fneg, termp, termn, posneg, cent); } // tracks @@ -286,12 +371,154 @@ struct NetchargeFluctuations { return; } + template + void histosMcRecoGen(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles) + { + if (!coll.has_mcCollision()) { + return; + } + + histos.fill(HIST("gen_hVtxZ_before"), coll.mcCollision().posZ()); + histos.fill(HIST("rec_hVtxZ_before"), coll.posZ()); + + if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return; + } + if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + return; + } + if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return; + } + if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return; + } + if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { + return; + } + + if (std::abs(coll.posZ()) > cVtxZcut) { + return; + } + + if constexpr (run == kRun3) { + if (cSel8Trig && !coll.sel8()) { + return; + } + + cent = coll.centFT0M(); // centrality for run3 + mult = coll.multFT0M(); + } else { + if (cSel7Trig && !coll.sel7()) { + return; + } + + cent = coll.centRun2V0M(); // centrality for run2 + mult = coll.multFV0M(); // multiplicity for run2 + } + + histos.fill(HIST("rec_hVtxZ_after"), coll.posZ()); + histos.fill(HIST("rec_hCentrality"), cent); + histos.fill(HIST("rec_hMultiplicity"), mult); + + int fpos_rec = 0, fneg_rec = 0, posneg_rec = 0, termn_rec = 0, termp_rec = 0; + int fpos_gen = 0, fneg_gen = 0, posneg_gen = 0, termn_gen = 0, termp_gen = 0; + + const auto& mccolgen = coll.template mcCollision_as(); + if (std::abs(mccolgen.posZ()) > cVtxZcut) { + return; + } + + const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); + histos.fill(HIST("gen_hVtxZ_after"), mccolgen.posZ()); + + for (auto track : inputTracks) { + if (!track.isGlobalTrack()) + continue; + if (std::fabs(track.dcaXY()) > cDcaXYcut) + continue; + if (std::fabs(track.dcaZ()) > cDcaZcut) + continue; + if (std::fabs(track.eta()) > cEtacut) + continue; + if ((track.pt() <= cPtmincut) || (track.pt() >= cPtmaxcut)) + continue; + if (track.sign() == 0) { + continue; + } + + histos.fill(HIST("rec_hPt"), track.pt()); + histos.fill(HIST("rec_hEta"), track.eta()); + + if (track.sign() == 1) { + fpos_rec += 1; + termp_rec = fpos_rec * (fpos_rec - 1); + } + + if (track.sign() == -1) { + fneg_rec += 1; + termn_rec = fneg_rec * (fneg_rec - 1); + } + + posneg_rec = fpos_rec * fneg_rec; + + net_charge_rec(fpos_rec, fneg_rec, fpos_rec * fpos_rec, fneg_rec * fneg_rec, + termp_rec, termn_rec, posneg_rec, cent); + } // loop over inputTracks (reco) + + for (const auto& mcpart : mcpartgen) { + if (!mcpart.isPhysicalPrimary()) { + continue; + } + int pid = mcpart.pdgCode(); + auto sign = 0; + auto* pd = pdg->GetParticle(pid); + if (pd != nullptr) { + sign = pd->Charge() / 3.; + } + if (sign == 0) { + continue; + } + + auto pdgcode = std::abs(mcpart.pdgCode()); + if (!(pdgcode == 11 || pdgcode == 13 || pdgcode == 211 || pdgcode == 321 || pdgcode == 2212)) + continue; + + if (std::fabs(mcpart.eta()) > cEtacut) + continue; + if ((mcpart.pt() <= cPtmincut) || (mcpart.pt() >= cPtmaxcut)) + continue; + histos.fill(HIST("gen_hPt"), mcpart.pt()); + histos.fill(HIST("gen_hEta"), mcpart.eta()); + histos.fill(HIST("gen_hSign"), sign); + + if (sign == 1) { + fpos_gen += 1; + termp_gen = fpos_gen * (fpos_gen - 1); + } + + if (sign == -1) { + fneg_gen += 1; + termn_gen = fneg_gen * (fneg_gen - 1); + } + + posneg_gen = fpos_gen * fneg_gen; + + net_charge_gen(fpos_gen, fneg_gen, fpos_gen * fpos_gen, fneg_gen * fneg_gen, + termp_gen, termn_gen, posneg_gen, cent); + + } // particle + } // void + + SliceCache cache; + Preslice mcTrack = o2::aod::mcparticle::mcCollisionId; + void processDataRun3(aod::MyCollisionRun3 const& coll, aod::MyTracks const& tracks) { calculation(coll, tracks); } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", false); void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) { @@ -300,11 +527,30 @@ struct NetchargeFluctuations { PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); + void processMcRun3(aod::MyMCCollisionRun3 const& coll, aod::MyMCTracks const& inputTracks, + aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + { + histosMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); + } + + PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", true); + + void processMcRun2(aod::MyMCCollisionRun2 const& coll, aod::MyMCTracks const& inputTracks, + aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + { + histosMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); + } + + PROCESS_SWITCH(NetchargeFluctuations, processMcRun2, "Process reconstructed", false); + }; // struct struct Netcharge_analysis { + Configurable cfgNSubsample{"cfgNSubsample", 20, "Number of subsamples"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; std::vector>> net; + std::vector>> Subsample; + TRandom3* fRndm = new TRandom3(0); void init(o2::framework::InitContext&) { @@ -318,7 +564,21 @@ struct Netcharge_analysis { registry.add("pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - } + + Subsample.resize(cfgNSubsample); + + for (int i = 0; i < cfgNSubsample; ++i) { + Subsample[i].resize(7); + Subsample[i][0] = std::get>(registry.add(Form("Subsample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][1] = std::get>(registry.add(Form("Subsample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][2] = std::get>(registry.add(Form("Subsample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][3] = std::get>(registry.add(Form("Subsample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][4] = std::get>(registry.add(Form("Subsample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][5] = std::get>(registry.add(Form("Subsample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][6] = std::get>(registry.add(Form("Subsample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + } + + } // void void process(aod::NetCharge::iterator const& event_netcharge) { @@ -329,7 +589,135 @@ struct Netcharge_analysis { registry.get(HIST("pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.possq_charge()); registry.get(HIST("neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negsq_charge()); registry.get(HIST("posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posneg_charge()); - } + + int SampleIndex = static_cast(cfgNSubsample * fRndm->Rndm()); + Subsample[SampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.pos_charge()); + Subsample[SampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.neg_charge()); + Subsample[SampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termp_charge()); + Subsample[SampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termn_charge()); + Subsample[SampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.possq_charge()); + Subsample[SampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negsq_charge()); + Subsample[SampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posneg_charge()); + } // void + +}; // struct Netcharge_analysis + +struct Netcharge_analysis_rec { + Configurable cfgNSubsample{"cfgNSubsample", 20, "Number of subsamples"}; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + std::vector>> net; + std::vector>> Subsample; + TRandom3* fRndm = new TRandom3(0); + + void init(o2::framework::InitContext&) + { + std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; + AxisSpec centAxis = {centBinning, "centrality"}; + + registry.add("pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + + Subsample.resize(cfgNSubsample); + for (int i = 0; i < cfgNSubsample; i++) { + Subsample[i].resize(7); + } + + for (int i = 0; i < cfgNSubsample; i++) { + Subsample[i][0] = std::get>(registry.add(Form("Subsample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][1] = std::get>(registry.add(Form("Subsample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][2] = std::get>(registry.add(Form("Subsample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][3] = std::get>(registry.add(Form("Subsample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][4] = std::get>(registry.add(Form("Subsample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][5] = std::get>(registry.add(Form("Subsample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][6] = std::get>(registry.add(Form("Subsample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + } + } // void + + void process(aod::NetChargeRec::iterator const& rec_netcharge) + { + registry.get(HIST("pos_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.pos_charge()); + registry.get(HIST("neg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.neg_charge()); + registry.get(HIST("termp_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termp_charge()); + registry.get(HIST("termn_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termn_charge()); + registry.get(HIST("pos_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.possq_charge()); + registry.get(HIST("neg_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.negsq_charge()); + registry.get(HIST("posneg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posneg_charge()); + + float l_Random = fRndm->Rndm(); + int SampleIndex = static_cast(cfgNSubsample * l_Random); + Subsample[SampleIndex][0]->Fill(rec_netcharge.centrality(), rec_netcharge.pos_charge()); + Subsample[SampleIndex][1]->Fill(rec_netcharge.centrality(), rec_netcharge.neg_charge()); + Subsample[SampleIndex][2]->Fill(rec_netcharge.centrality(), rec_netcharge.termp_charge()); + Subsample[SampleIndex][3]->Fill(rec_netcharge.centrality(), rec_netcharge.termn_charge()); + Subsample[SampleIndex][4]->Fill(rec_netcharge.centrality(), rec_netcharge.possq_charge()); + Subsample[SampleIndex][5]->Fill(rec_netcharge.centrality(), rec_netcharge.negsq_charge()); + Subsample[SampleIndex][6]->Fill(rec_netcharge.centrality(), rec_netcharge.posneg_charge()); + } // void +}; // struct rec + +struct Netcharge_analysis_gen { + Configurable cfgNSubsample{"cfgNSubsample", 20, "Number of subsamples"}; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + std::vector>> net; + std::vector>> Subsample; + TRandom3* fRndm = new TRandom3(0); + + void init(o2::framework::InitContext&) + { + std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; + AxisSpec centAxis = {centBinning, "centrality"}; + + registry.add("pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + + Subsample.resize(cfgNSubsample); + for (int i = 0; i < cfgNSubsample; i++) { + Subsample[i].resize(7); + } + + for (int i = 0; i < cfgNSubsample; i++) { + Subsample[i][0] = std::get>(registry.add(Form("Subsample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][1] = std::get>(registry.add(Form("Subsample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][2] = std::get>(registry.add(Form("Subsample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][3] = std::get>(registry.add(Form("Subsample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][4] = std::get>(registry.add(Form("Subsample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][5] = std::get>(registry.add(Form("Subsample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + Subsample[i][6] = std::get>(registry.add(Form("Subsample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + } + } // void + + void process(aod::NetChargeGen::iterator const& gen_netcharge) + { + registry.get(HIST("pos_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.pos_charge()); + registry.get(HIST("neg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.neg_charge()); + registry.get(HIST("termp_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termp_charge()); + registry.get(HIST("termn_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termn_charge()); + registry.get(HIST("pos_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.possq_charge()); + registry.get(HIST("neg_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.negsq_charge()); + registry.get(HIST("posneg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posneg_charge()); + + float l_Random = fRndm->Rndm(); + int SampleIndex = static_cast(cfgNSubsample * l_Random); + Subsample[SampleIndex][0]->Fill(gen_netcharge.centrality(), gen_netcharge.pos_charge()); + Subsample[SampleIndex][1]->Fill(gen_netcharge.centrality(), gen_netcharge.neg_charge()); + Subsample[SampleIndex][2]->Fill(gen_netcharge.centrality(), gen_netcharge.termp_charge()); + Subsample[SampleIndex][3]->Fill(gen_netcharge.centrality(), gen_netcharge.termn_charge()); + Subsample[SampleIndex][4]->Fill(gen_netcharge.centrality(), gen_netcharge.possq_charge()); + Subsample[SampleIndex][5]->Fill(gen_netcharge.centrality(), gen_netcharge.negsq_charge()); + Subsample[SampleIndex][6]->Fill(gen_netcharge.centrality(), gen_netcharge.posneg_charge()); + } // void }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) @@ -337,6 +725,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return WorkflowSpec{ {adaptAnalysisTask(cfgc)}, {adaptAnalysisTask(cfgc)}, + {adaptAnalysisTask(cfgc)}, + {adaptAnalysisTask(cfgc)} }; } From bef25acdd40c48b0d7e1445a714573ebc92e6ed5 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 4 Jun 2025 13:15:06 +0530 Subject: [PATCH 04/14] cfnetchargflu --- .../Tasks/netchargeFluctuations.cxx | 343 +++++++++--------- 1 file changed, 174 insertions(+), 169 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index b16ddaddfdf..aef0bc555e1 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -1,3 +1,9 @@ +/** + * \file netchargeFluctuations.cxx + * \brief Study the net charge fluctuations by observable. + * \author Nida Malik + */ + // Copyright CERN 2025 // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". @@ -6,10 +12,6 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// Author: Nida Malik (nida.malik@cern.ch) -// Affiliation: Department of Physics, Aligarh Muslim University, India -// -// Description: Study the net charge fluctuations by observable #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -32,6 +34,7 @@ #include "Common/CCDB/TriggerAliases.h" #include "Framework/HistogramRegistry.h" #include "Framework/O2DatabasePDGPlugin.h" +#include "CommonConstants/PhysicsConstants.h" #include "TProfile.h" #include "TProfile2D.h" #include "TRandom3.h" @@ -40,42 +43,43 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace std; +using namespace o2::constants::physics; namespace o2::aod { namespace netCharge { -DECLARE_SOA_COLUMN(PosCharge, pos_charge, float); -DECLARE_SOA_COLUMN(NegCharge, neg_charge, float); -DECLARE_SOA_COLUMN(PosSqCharge, possq_charge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negsq_charge, float); -DECLARE_SOA_COLUMN(TermpCharge, termp_charge, float); -DECLARE_SOA_COLUMN(TermnCharge, termn_charge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posneg_charge, float); +DECLARE_SOA_COLUMN(PosCharge, posCharge, float); +DECLARE_SOA_COLUMN(NegCharge, negCharge, float); +DECLARE_SOA_COLUMN(PosSqCharge, possqCharge, float); +DECLARE_SOA_COLUMN(NegSqCharge, negsqCharge, float); +DECLARE_SOA_COLUMN(TermpCharge, termpCharge, float); +DECLARE_SOA_COLUMN(TermnCharge, termnCharge, float); +DECLARE_SOA_COLUMN(PosNegCharge, posnegCharge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); } // namespace netCharge namespace netChargeRec { -DECLARE_SOA_COLUMN(PosCharge, pos_charge, float); -DECLARE_SOA_COLUMN(NegCharge, neg_charge, float); -DECLARE_SOA_COLUMN(PosSqCharge, possq_charge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negsq_charge, float); -DECLARE_SOA_COLUMN(TermpCharge, termp_charge, float); -DECLARE_SOA_COLUMN(TermnCharge, termn_charge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posneg_charge, float); +DECLARE_SOA_COLUMN(PosCharge, posCharge, float); +DECLARE_SOA_COLUMN(NegCharge, negCharge, float); +DECLARE_SOA_COLUMN(PosSqCharge, possqCharge, float); +DECLARE_SOA_COLUMN(NegSqCharge, negsqCharge, float); +DECLARE_SOA_COLUMN(TermpCharge, termpCharge, float); +DECLARE_SOA_COLUMN(TermnCharge, termnCharge, float); +DECLARE_SOA_COLUMN(PosNegCharge, posnegCharge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); } // namespace netChargeRec namespace netChargeGen { -DECLARE_SOA_COLUMN(PosCharge, pos_charge, float); -DECLARE_SOA_COLUMN(NegCharge, neg_charge, float); -DECLARE_SOA_COLUMN(PosSqCharge, possq_charge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negsq_charge, float); -DECLARE_SOA_COLUMN(TermpCharge, termp_charge, float); -DECLARE_SOA_COLUMN(TermnCharge, termn_charge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posneg_charge, float); +DECLARE_SOA_COLUMN(PosCharge, posCharge, float); +DECLARE_SOA_COLUMN(NegCharge, negCharge, float); +DECLARE_SOA_COLUMN(PosSqCharge, possqCharge, float); +DECLARE_SOA_COLUMN(NegSqCharge, negsqCharge, float); +DECLARE_SOA_COLUMN(TermpCharge, termpCharge, float); +DECLARE_SOA_COLUMN(TermnCharge, termnCharge, float); +DECLARE_SOA_COLUMN(PosNegCharge, posnegCharge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); } // namespace netChargeGen @@ -134,14 +138,14 @@ enum RunType { struct NetchargeFluctuations { Produces net_charge; - Produces net_charge_rec; + Produces netChargeRec; Produces net_charge_gen; - Service pdg; + Service pdgService; - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry histogramRegistry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Configurables - Configurable cVtxZcut{"cVtx", 10.f, "Vertex Z"}; + Configurable vertexZcut{"vertexZ", 10.f, "Vertex Z"}; Configurable cEtacut{"cEta", 0.8, "Eta cut"}; Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; Configurable cPtmaxcut{"cPtmaxcut", 5.0, "Pt max cut"}; @@ -169,7 +173,7 @@ struct NetchargeFluctuations { float mult = 0.; void init(o2::framework::InitContext&) { - const AxisSpec vtxZAxis = {80, -20, 20, "V_{Z} (cm)"}; + const AxisSpec vtxzAxis = {80, -20, 20, "V_{Z} (cm)"}; const AxisSpec dcaAxis = {250, -0.5, 0.5, "DCA_{xy} (cm)"}; const AxisSpec dcazAxis = {250, -0.5, 0.5, "DCA_{z} (cm)"}; const AxisSpec ptAxis = {70, 0.0, 7.0, "#it{p}_{T} (GeV/#it{c})"}; @@ -182,57 +186,57 @@ struct NetchargeFluctuations { const AxisSpec eventsAxis = {10, 0, 10, ""}; const AxisSpec signAxis = {20, -10, 10, ""}; - histos.add("hVtxZ_before", "", kTH1F, {vtxZAxis}); - histos.add("hDcaXY_before", "", kTH1F, {dcaAxis}); - histos.add("hDcaZ_before", "", kTH1F, {dcazAxis}); - histos.add("hTPCchi2perCluster_before", "", kTH1D, {TPCChi2Axis}); - histos.add("hITSchi2perCluster_before", "", kTH1D, {ITSChi2Axis}); - histos.add("hTPCCrossedrows_before", "", kTH1D, {CrossedrowTPCAxis}); - histos.add("hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); - histos.add("hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); - histos.add("hVtxZ_after", "", kTH1F, {vtxZAxis}); - histos.add("hDcaXY_after", "", kTH1F, {dcaAxis}); - histos.add("hDcaZ_after", "", kTH1F, {dcazAxis}); - histos.add("hTPCchi2perCluster_after", "", kTH1D, {TPCChi2Axis}); - histos.add("hITSchi2perCluster_after", "", kTH1D, {ITSChi2Axis}); - histos.add("hTPCCrossedrows_after", "", kTH1D, {CrossedrowTPCAxis}); - histos.add("hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); - histos.add("hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); - histos.add("hEta", "", kTH1F, {etaAxis}); - histos.add("hPt", "", kTH1F, {ptAxis}); - histos.add("hCentrality", "", kTH1F, {centAxis}); - histos.add("hMultiplicity", "", kTH1F, {multAxis}); - histos.add("rec_hVtxZ_before", "", kTH1F, {vtxZAxis}); - histos.add("gen_hVtxZ_before", "", kTH1F, {vtxZAxis}); - histos.add("rec_hDcaXY_before", "", kTH1D, {dcaAxis}); - histos.add("rec_hDcaZ_before", "", kTH1D, {dcazAxis}); - histos.add("rec_hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {TPCChi2Axis}); - histos.add("rec_hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {ITSChi2Axis}); - histos.add("rec_hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); - histos.add("rec_hVtxZ_after", "", kTH1F, {vtxZAxis}); - histos.add("gen_hVtxZ_after", "", kTH1F, {vtxZAxis}); - histos.add("rec_hDcaXY_after", "", kTH1D, {dcaAxis}); - histos.add("rec_hDcaZ_after", "", kTH1D, {dcazAxis}); - histos.add("rec_hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {TPCChi2Axis}); - histos.add("rec_hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {ITSChi2Axis}); - histos.add("rec_hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); - histos.add("gen_hEta", "", kTH1F, {etaAxis}); - histos.add("rec_hEta", "", kTH1F, {etaAxis}); - histos.add("gen_hSign", "", kTH1F, {signAxis}); - histos.add("gen_hPt", "", kTH1F, {ptAxis}); - histos.add("rec_hPt", "", kTH1F, {ptAxis}); - histos.add("rec_hPtDcaXY_after", "hPtDCAxy", kTH2D, {ptAxis, dcaAxis}); - histos.add("rec_hPtDcaZ_after", "hPtDCAz", kTH2D, {ptAxis, dcazAxis}); - histos.add("rec_hCentrality", "", kTH1D, {centAxis}); - histos.add("gen_hCentrality", "", kTH1D, {centAxis}); - histos.add("rec_hMultiplicity", "", kTH1D, {multAxis}); - histos.add("gen_hMultiplicity", "", kTH1D, {multAxis}); + histogramRegistry.add("hVtxZ_before", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("hDcaXY_before", "", kTH1F, {dcaAxis}); + histogramRegistry.add("hDcaZ_before", "", kTH1F, {dcazAxis}); + histogramRegistry.add("hTPCchi2perCluster_before", "", kTH1D, {TPCChi2Axis}); + histogramRegistry.add("hITSchi2perCluster_before", "", kTH1D, {ITSChi2Axis}); + histogramRegistry.add("hTPCCrossedrows_before", "", kTH1D, {CrossedrowTPCAxis}); + histogramRegistry.add("hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); + histogramRegistry.add("hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); + histogramRegistry.add("hVtxZ_after", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("hDcaXY_after", "", kTH1F, {dcaAxis}); + histogramRegistry.add("hDcaZ_after", "", kTH1F, {dcazAxis}); + histogramRegistry.add("hTPCchi2perCluster_after", "", kTH1D, {TPCChi2Axis}); + histogramRegistry.add("hITSchi2perCluster_after", "", kTH1D, {ITSChi2Axis}); + histogramRegistry.add("hTPCCrossedrows_after", "", kTH1D, {CrossedrowTPCAxis}); + histogramRegistry.add("hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); + histogramRegistry.add("hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); + histogramRegistry.add("hEta", "", kTH1F, {etaAxis}); + histogramRegistry.add("hPt", "", kTH1F, {ptAxis}); + histogramRegistry.add("hCentrality", "", kTH1F, {centAxis}); + histogramRegistry.add("hMultiplicity", "", kTH1F, {multAxis}); + histogramRegistry.add("rec_hVtxZ_before", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("gen_hVtxZ_before", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("rec_hDcaXY_before", "", kTH1D, {dcaAxis}); + histogramRegistry.add("rec_hDcaZ_before", "", kTH1D, {dcazAxis}); + histogramRegistry.add("rec_hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {TPCChi2Axis}); + histogramRegistry.add("rec_hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {ITSChi2Axis}); + histogramRegistry.add("rec_hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); + histogramRegistry.add("rec_hVtxZ_after", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("gen_hVtxZ_after", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("rec_hDcaXY_after", "", kTH1D, {dcaAxis}); + histogramRegistry.add("rec_hDcaZ_after", "", kTH1D, {dcazAxis}); + histogramRegistry.add("rec_hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {TPCChi2Axis}); + histogramRegistry.add("rec_hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {ITSChi2Axis}); + histogramRegistry.add("rec_hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); + histogramRegistry.add("gen_hEta", "", kTH1F, {etaAxis}); + histogramRegistry.add("rec_hEta", "", kTH1F, {etaAxis}); + histogramRegistry.add("gen_hSign", "", kTH1F, {signAxis}); + histogramRegistry.add("gen_hPt", "", kTH1F, {ptAxis}); + histogramRegistry.add("rec_hPt", "", kTH1F, {ptAxis}); + histogramRegistry.add("rec_hPtDcaXY_after", "hPtDCAxy", kTH2D, {ptAxis, dcaAxis}); + histogramRegistry.add("rec_hPtDcaZ_after", "hPtDCAz", kTH2D, {ptAxis, dcazAxis}); + histogramRegistry.add("rec_hCentrality", "", kTH1D, {centAxis}); + histogramRegistry.add("gen_hCentrality", "", kTH1D, {centAxis}); + histogramRegistry.add("rec_hMultiplicity", "", kTH1D, {multAxis}); + histogramRegistry.add("gen_hMultiplicity", "", kTH1D, {multAxis}); } template bool selCollision(C const& coll) { - if (std::abs(coll.posZ()) > cVtxZcut) { + if (std::abs(coll.posZ()) > vertexZcut) { return false; } // Reject the collisions with large vertex-z @@ -318,41 +322,41 @@ struct NetchargeFluctuations { template void calculation(C const& coll, T const& tracks) { - histos.fill(HIST("hVtxZ_before"), coll.posZ()); + histogramRegistry.fill(HIST("hVtxZ_before"), coll.posZ()); if (!selCollision(coll)) { return; } - histos.fill(HIST("hVtxZ_after"), coll.posZ()); - histos.fill(HIST("hCentrality"), cent); - histos.fill(HIST("hMultiplicity"), mult); + histogramRegistry.fill(HIST("hVtxZ_after"), coll.posZ()); + histogramRegistry.fill(HIST("hCentrality"), cent); + histogramRegistry.fill(HIST("hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - for (auto track : tracks) { - histos.fill(HIST("hTPCchi2perCluster_before"), track.tpcChi2NCl()); - histos.fill(HIST("hITSchi2perCluster_before"), track.itsChi2NCl()); - histos.fill(HIST("hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); - histos.fill(HIST("hDcaXY_before"), track.dcaXY()); - histos.fill(HIST("hDcaZ_before"), track.dcaZ()); - histos.fill(HIST("hPtDcaXY_before"), track.pt(), track.dcaXY()); - histos.fill(HIST("hPtDcaZ_before"), track.pt(), track.dcaZ()); + for (const auto& track : tracks) { + histogramRegistry.fill(HIST("hTPCchi2perCluster_before"), track.tpcChi2NCl()); + histogramRegistry.fill(HIST("hITSchi2perCluster_before"), track.itsChi2NCl()); + histogramRegistry.fill(HIST("hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); + histogramRegistry.fill(HIST("hDcaXY_before"), track.dcaXY()); + histogramRegistry.fill(HIST("hDcaZ_before"), track.dcaZ()); + histogramRegistry.fill(HIST("hPtDcaXY_before"), track.pt(), track.dcaXY()); + histogramRegistry.fill(HIST("hPtDcaZ_before"), track.pt(), track.dcaZ()); if (!selTrack(track)) { continue; } if (track.sign() == 0) continue; - histos.fill(HIST("hDcaXY_after"), track.dcaXY()); - histos.fill(HIST("hDcaZ_after"), track.dcaZ()); - histos.fill(HIST("hPt"), track.pt()); - histos.fill(HIST("hEta"), track.eta()); - histos.fill(HIST("hPtDcaXY_after"), track.pt(), track.dcaXY()); - histos.fill(HIST("hPtDcaZ_after"), track.pt(), track.dcaZ()); - histos.fill(HIST("hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); - histos.fill(HIST("hTPCchi2perCluster_after"), track.tpcChi2NCl()); - histos.fill(HIST("hITSchi2perCluster_after"), track.itsChi2NCl()); + histogramRegistry.fill(HIST("hDcaXY_after"), track.dcaXY()); + histogramRegistry.fill(HIST("hDcaZ_after"), track.dcaZ()); + histogramRegistry.fill(HIST("hPt"), track.pt()); + histogramRegistry.fill(HIST("hEta"), track.eta()); + histogramRegistry.fill(HIST("hPtDcaXY_after"), track.pt(), track.dcaXY()); + histogramRegistry.fill(HIST("hPtDcaZ_after"), track.pt(), track.dcaZ()); + histogramRegistry.fill(HIST("hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); + histogramRegistry.fill(HIST("hTPCchi2perCluster_after"), track.tpcChi2NCl()); + histogramRegistry.fill(HIST("hITSchi2perCluster_after"), track.itsChi2NCl()); if (track.sign() == 1) { fpos += 1; @@ -372,14 +376,14 @@ struct NetchargeFluctuations { } template - void histosMcRecoGen(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles) + void histogramRegistryMcRecoGen(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles) { if (!coll.has_mcCollision()) { return; } - histos.fill(HIST("gen_hVtxZ_before"), coll.mcCollision().posZ()); - histos.fill(HIST("rec_hVtxZ_before"), coll.posZ()); + histogramRegistry.fill(HIST("gen_hVtxZ_before"), coll.mcCollision().posZ()); + histogramRegistry.fill(HIST("rec_hVtxZ_before"), coll.posZ()); if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { return; @@ -397,7 +401,7 @@ struct NetchargeFluctuations { return; } - if (std::abs(coll.posZ()) > cVtxZcut) { + if (std::abs(coll.posZ()) > vertexZcut) { return; } @@ -417,22 +421,22 @@ struct NetchargeFluctuations { mult = coll.multFV0M(); // multiplicity for run2 } - histos.fill(HIST("rec_hVtxZ_after"), coll.posZ()); - histos.fill(HIST("rec_hCentrality"), cent); - histos.fill(HIST("rec_hMultiplicity"), mult); + histogramRegistry.fill(HIST("rec_hVtxZ_after"), coll.posZ()); + histogramRegistry.fill(HIST("rec_hCentrality"), cent); + histogramRegistry.fill(HIST("rec_hMultiplicity"), mult); int fpos_rec = 0, fneg_rec = 0, posneg_rec = 0, termn_rec = 0, termp_rec = 0; int fpos_gen = 0, fneg_gen = 0, posneg_gen = 0, termn_gen = 0, termp_gen = 0; const auto& mccolgen = coll.template mcCollision_as(); - if (std::abs(mccolgen.posZ()) > cVtxZcut) { + if (std::abs(mccolgen.posZ()) > vertexZcut) { return; } const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); - histos.fill(HIST("gen_hVtxZ_after"), mccolgen.posZ()); + histogramRegistry.fill(HIST("gen_hVtxZ_after"), mccolgen.posZ()); - for (auto track : inputTracks) { + for (const auto& track : inputTracks) { if (!track.isGlobalTrack()) continue; if (std::fabs(track.dcaXY()) > cDcaXYcut) @@ -447,8 +451,8 @@ struct NetchargeFluctuations { continue; } - histos.fill(HIST("rec_hPt"), track.pt()); - histos.fill(HIST("rec_hEta"), track.eta()); + histogramRegistry.fill(HIST("rec_hPt"), track.pt()); + histogramRegistry.fill(HIST("rec_hEta"), track.eta()); if (track.sign() == 1) { fpos_rec += 1; @@ -462,7 +466,7 @@ struct NetchargeFluctuations { posneg_rec = fpos_rec * fneg_rec; - net_charge_rec(fpos_rec, fneg_rec, fpos_rec * fpos_rec, fneg_rec * fneg_rec, + netChargeRec(fpos_rec, fneg_rec, fpos_rec * fpos_rec, fneg_rec * fneg_rec, termp_rec, termn_rec, posneg_rec, cent); } // loop over inputTracks (reco) @@ -472,25 +476,26 @@ struct NetchargeFluctuations { } int pid = mcpart.pdgCode(); auto sign = 0; - auto* pd = pdg->GetParticle(pid); + auto* pd = pdgService->GetParticle(pid); if (pd != nullptr) { sign = pd->Charge() / 3.; } if (sign == 0) { continue; } - - auto pdgcode = std::abs(mcpart.pdgCode()); - if (!(pdgcode == 11 || pdgcode == 13 || pdgcode == 211 || pdgcode == 321 || pdgcode == 2212)) - continue; - + //auto pdgServicecode = mcpart.pdgCode(); + if (std::abs(pid) != kElectron && std::abs(pid) != kMuonMinus && std::abs(pid) != kPiPlus && std::abs(pid) != kKPlus && std::abs(pid) != kProton) { + continue; + + } + if (std::fabs(mcpart.eta()) > cEtacut) continue; if ((mcpart.pt() <= cPtmincut) || (mcpart.pt() >= cPtmaxcut)) continue; - histos.fill(HIST("gen_hPt"), mcpart.pt()); - histos.fill(HIST("gen_hEta"), mcpart.eta()); - histos.fill(HIST("gen_hSign"), sign); + histogramRegistry.fill(HIST("gen_hPt"), mcpart.pt()); + histogramRegistry.fill(HIST("gen_hEta"), mcpart.eta()); + histogramRegistry.fill(HIST("gen_hSign"), sign); if (sign == 1) { fpos_gen += 1; @@ -530,7 +535,7 @@ struct NetchargeFluctuations { void processMcRun3(aod::MyMCCollisionRun3 const& coll, aod::MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - histosMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); + histogramRegistryMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); } PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", true); @@ -538,14 +543,14 @@ struct NetchargeFluctuations { void processMcRun2(aod::MyMCCollisionRun2 const& coll, aod::MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - histosMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); + histogramRegistryMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); } PROCESS_SWITCH(NetchargeFluctuations, processMcRun2, "Process reconstructed", false); }; // struct -struct Netcharge_analysis { +struct NetchargeAnalysis { Configurable cfgNSubsample{"cfgNSubsample", 20, "Number of subsamples"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; std::vector>> net; @@ -582,27 +587,27 @@ struct Netcharge_analysis { void process(aod::NetCharge::iterator const& event_netcharge) { - registry.get(HIST("pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.pos_charge()); - registry.get(HIST("neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.neg_charge()); - registry.get(HIST("termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termp_charge()); - registry.get(HIST("termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termn_charge()); - registry.get(HIST("pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.possq_charge()); - registry.get(HIST("neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negsq_charge()); - registry.get(HIST("posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posneg_charge()); + registry.get(HIST("pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); + registry.get(HIST("neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); + registry.get(HIST("termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termpCharge()); + registry.get(HIST("termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termnCharge()); + registry.get(HIST("pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.possqCharge()); + registry.get(HIST("neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negsqCharge()); + registry.get(HIST("posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posnegCharge()); int SampleIndex = static_cast(cfgNSubsample * fRndm->Rndm()); - Subsample[SampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.pos_charge()); - Subsample[SampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.neg_charge()); - Subsample[SampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termp_charge()); - Subsample[SampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termn_charge()); - Subsample[SampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.possq_charge()); - Subsample[SampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negsq_charge()); - Subsample[SampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posneg_charge()); + Subsample[SampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); + Subsample[SampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); + Subsample[SampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termpCharge()); + Subsample[SampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termnCharge()); + Subsample[SampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.possqCharge()); + Subsample[SampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negsqCharge()); + Subsample[SampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posnegCharge()); } // void }; // struct Netcharge_analysis -struct Netcharge_analysis_rec { +struct NetchargeAnalysisRec { Configurable cfgNSubsample{"cfgNSubsample", 20, "Number of subsamples"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -641,27 +646,27 @@ struct Netcharge_analysis_rec { void process(aod::NetChargeRec::iterator const& rec_netcharge) { - registry.get(HIST("pos_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.pos_charge()); - registry.get(HIST("neg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.neg_charge()); - registry.get(HIST("termp_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termp_charge()); - registry.get(HIST("termn_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termn_charge()); - registry.get(HIST("pos_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.possq_charge()); - registry.get(HIST("neg_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.negsq_charge()); - registry.get(HIST("posneg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posneg_charge()); + registry.get(HIST("pos_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posCharge()); + registry.get(HIST("neg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.negCharge()); + registry.get(HIST("termp_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termpCharge()); + registry.get(HIST("termn_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termnCharge()); + registry.get(HIST("pos_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.possqCharge()); + registry.get(HIST("neg_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.negsqCharge()); + registry.get(HIST("posneg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posnegCharge()); float l_Random = fRndm->Rndm(); int SampleIndex = static_cast(cfgNSubsample * l_Random); - Subsample[SampleIndex][0]->Fill(rec_netcharge.centrality(), rec_netcharge.pos_charge()); - Subsample[SampleIndex][1]->Fill(rec_netcharge.centrality(), rec_netcharge.neg_charge()); - Subsample[SampleIndex][2]->Fill(rec_netcharge.centrality(), rec_netcharge.termp_charge()); - Subsample[SampleIndex][3]->Fill(rec_netcharge.centrality(), rec_netcharge.termn_charge()); - Subsample[SampleIndex][4]->Fill(rec_netcharge.centrality(), rec_netcharge.possq_charge()); - Subsample[SampleIndex][5]->Fill(rec_netcharge.centrality(), rec_netcharge.negsq_charge()); - Subsample[SampleIndex][6]->Fill(rec_netcharge.centrality(), rec_netcharge.posneg_charge()); + Subsample[SampleIndex][0]->Fill(rec_netcharge.centrality(), rec_netcharge.posCharge()); + Subsample[SampleIndex][1]->Fill(rec_netcharge.centrality(), rec_netcharge.negCharge()); + Subsample[SampleIndex][2]->Fill(rec_netcharge.centrality(), rec_netcharge.termpCharge()); + Subsample[SampleIndex][3]->Fill(rec_netcharge.centrality(), rec_netcharge.termnCharge()); + Subsample[SampleIndex][4]->Fill(rec_netcharge.centrality(), rec_netcharge.possqCharge()); + Subsample[SampleIndex][5]->Fill(rec_netcharge.centrality(), rec_netcharge.negsqCharge()); + Subsample[SampleIndex][6]->Fill(rec_netcharge.centrality(), rec_netcharge.posnegCharge()); } // void }; // struct rec -struct Netcharge_analysis_gen { +struct NetchargeAnalysisGen { Configurable cfgNSubsample{"cfgNSubsample", 20, "Number of subsamples"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -700,23 +705,23 @@ struct Netcharge_analysis_gen { void process(aod::NetChargeGen::iterator const& gen_netcharge) { - registry.get(HIST("pos_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.pos_charge()); - registry.get(HIST("neg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.neg_charge()); - registry.get(HIST("termp_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termp_charge()); - registry.get(HIST("termn_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termn_charge()); - registry.get(HIST("pos_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.possq_charge()); - registry.get(HIST("neg_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.negsq_charge()); - registry.get(HIST("posneg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posneg_charge()); + registry.get(HIST("pos_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posCharge()); + registry.get(HIST("neg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.negCharge()); + registry.get(HIST("termp_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termpCharge()); + registry.get(HIST("termn_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termnCharge()); + registry.get(HIST("pos_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.possqCharge()); + registry.get(HIST("neg_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.negsqCharge()); + registry.get(HIST("posneg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posnegCharge()); float l_Random = fRndm->Rndm(); int SampleIndex = static_cast(cfgNSubsample * l_Random); - Subsample[SampleIndex][0]->Fill(gen_netcharge.centrality(), gen_netcharge.pos_charge()); - Subsample[SampleIndex][1]->Fill(gen_netcharge.centrality(), gen_netcharge.neg_charge()); - Subsample[SampleIndex][2]->Fill(gen_netcharge.centrality(), gen_netcharge.termp_charge()); - Subsample[SampleIndex][3]->Fill(gen_netcharge.centrality(), gen_netcharge.termn_charge()); - Subsample[SampleIndex][4]->Fill(gen_netcharge.centrality(), gen_netcharge.possq_charge()); - Subsample[SampleIndex][5]->Fill(gen_netcharge.centrality(), gen_netcharge.negsq_charge()); - Subsample[SampleIndex][6]->Fill(gen_netcharge.centrality(), gen_netcharge.posneg_charge()); + Subsample[SampleIndex][0]->Fill(gen_netcharge.centrality(), gen_netcharge.posCharge()); + Subsample[SampleIndex][1]->Fill(gen_netcharge.centrality(), gen_netcharge.negCharge()); + Subsample[SampleIndex][2]->Fill(gen_netcharge.centrality(), gen_netcharge.termpCharge()); + Subsample[SampleIndex][3]->Fill(gen_netcharge.centrality(), gen_netcharge.termnCharge()); + Subsample[SampleIndex][4]->Fill(gen_netcharge.centrality(), gen_netcharge.possqCharge()); + Subsample[SampleIndex][5]->Fill(gen_netcharge.centrality(), gen_netcharge.negsqCharge()); + Subsample[SampleIndex][6]->Fill(gen_netcharge.centrality(), gen_netcharge.posnegCharge()); } // void }; // struct @@ -724,9 +729,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ {adaptAnalysisTask(cfgc)}, - {adaptAnalysisTask(cfgc)}, - {adaptAnalysisTask(cfgc)}, - {adaptAnalysisTask(cfgc)} + {adaptAnalysisTask(cfgc)}, + {adaptAnalysisTask(cfgc)}, + {adaptAnalysisTask(cfgc)} }; } From b61684f453bcd0b71dcde95c2eb87523e79c9be4 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 4 Jun 2025 14:31:12 +0530 Subject: [PATCH 05/14] cfnetchargfluc --- .../Tasks/netchargeFluctuations.cxx | 399 +++++++++--------- 1 file changed, 198 insertions(+), 201 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index aef0bc555e1..5118d151509 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -1,18 +1,20 @@ -/** - * \file netchargeFluctuations.cxx - * \brief Study the net charge fluctuations by observable. - * \author Nida Malik - */ - -// Copyright CERN 2025 +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". // // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// +/// \file netchargeFluctuations.cxx +/// \brief Calculate nu_dyn fluctuations +/// For charged particles +/// For RUN-3 +/// +/// \author Nida Malik #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Common/DataModel/EventSelection.h" @@ -45,73 +47,70 @@ using namespace o2::framework::expressions; using namespace std; using namespace o2::constants::physics; -namespace o2::aod -{ -namespace netCharge -{ +namespace o2{ +namespace aod{ +namespace net_charge{ DECLARE_SOA_COLUMN(PosCharge, posCharge, float); DECLARE_SOA_COLUMN(NegCharge, negCharge, float); -DECLARE_SOA_COLUMN(PosSqCharge, possqCharge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negsqCharge, float); -DECLARE_SOA_COLUMN(TermpCharge, termpCharge, float); -DECLARE_SOA_COLUMN(TermnCharge, termnCharge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posnegCharge, float); +DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); +DECLARE_SOA_COLUMN(NegSqCharge, negSqCharge, float); +DECLARE_SOA_COLUMN(TermPCharge, termPCharge, float); +DECLARE_SOA_COLUMN(TermNCharge, termNCharge, float); +DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace netCharge +} // namespace net_charge -namespace netChargeRec -{ +namespace net_charge_rec{ DECLARE_SOA_COLUMN(PosCharge, posCharge, float); DECLARE_SOA_COLUMN(NegCharge, negCharge, float); -DECLARE_SOA_COLUMN(PosSqCharge, possqCharge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negsqCharge, float); -DECLARE_SOA_COLUMN(TermpCharge, termpCharge, float); -DECLARE_SOA_COLUMN(TermnCharge, termnCharge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posnegCharge, float); +DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); +DECLARE_SOA_COLUMN(NegSqCharge, negSqCharge, float); +DECLARE_SOA_COLUMN(TermPCharge, termPCharge, float); +DECLARE_SOA_COLUMN(TermNCharge, termNCharge, float); +DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace netChargeRec +} // namespace net_charge_rec -namespace netChargeGen -{ +namespace net_charge_gen{ DECLARE_SOA_COLUMN(PosCharge, posCharge, float); DECLARE_SOA_COLUMN(NegCharge, negCharge, float); -DECLARE_SOA_COLUMN(PosSqCharge, possqCharge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negsqCharge, float); -DECLARE_SOA_COLUMN(TermpCharge, termpCharge, float); -DECLARE_SOA_COLUMN(TermnCharge, termnCharge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posnegCharge, float); +DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); +DECLARE_SOA_COLUMN(NegSqCharge, negSqCharge, float); +DECLARE_SOA_COLUMN(TermPCharge, termPCharge, float); +DECLARE_SOA_COLUMN(TermNCharge, termNCharge, float); +DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace netChargeGen +} // namespace net_charge_gen DECLARE_SOA_TABLE(NetCharge, "AOD", "NETChargefluct", - netCharge::PosCharge, - netCharge::NegCharge, - netCharge::PosSqCharge, - netCharge::NegSqCharge, - netCharge::TermpCharge, - netCharge::TermnCharge, - netCharge::PosNegCharge, - netCharge::Centrality); + net_charge::PosCharge, + net_charge::NegCharge, + net_charge::PosSqCharge, + net_charge::NegSqCharge, + net_charge::TermPCharge, + net_charge::TermNCharge, + net_charge::PosNegCharge, + net_charge::Centrality); DECLARE_SOA_TABLE(NetChargeRec, "AOD", "NETfluctRec", - netChargeRec::PosCharge, - netChargeRec::NegCharge, - netChargeRec::PosSqCharge, - netChargeRec::NegSqCharge, - netChargeRec::TermpCharge, - netChargeRec::TermnCharge, - netChargeRec::PosNegCharge, - netChargeRec::Centrality); + net_charge_rec::PosCharge, + net_charge_rec::NegCharge, + net_charge_rec::PosSqCharge, + net_charge_rec::NegSqCharge, + net_charge_rec::TermPCharge, + net_charge_rec::TermNCharge, + net_charge_rec::PosNegCharge, + net_charge_rec::Centrality); DECLARE_SOA_TABLE(NetChargeGen, "AOD", "NETfluctGen", - netChargeGen::PosCharge, - netChargeGen::NegCharge, - netChargeGen::PosSqCharge, - netChargeGen::NegSqCharge, - netChargeGen::TermpCharge, - netChargeGen::TermnCharge, - netChargeGen::PosNegCharge, - netChargeGen::Centrality); + net_charge_gen::PosCharge, + net_charge_gen::NegCharge, + net_charge_gen::PosSqCharge, + net_charge_gen::NegSqCharge, + net_charge_gen::TermPCharge, + net_charge_gen::TermNCharge, + net_charge_gen::PosNegCharge, + net_charge_gen::Centrality); using MyCollisionsRun2 = soa::Join; using MyCollisionRun2 = MyCollisionsRun2::iterator; @@ -128,8 +127,8 @@ using MyMCCollisionRun3 = MyMCCollisionsRun3::iterator; using MyMCTracks = soa::Join; using MyMCTrack = MyMCTracks::iterator; - -} // namespace o2::aod +} //aod +} // namespace o2 enum RunType { kRun3 = 0, @@ -137,25 +136,23 @@ enum RunType { }; struct NetchargeFluctuations { - Produces net_charge; + Produces netCharge; Produces netChargeRec; - Produces net_charge_gen; + Produces netChargeGen; Service pdgService; HistogramRegistry histogramRegistry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Configurables - Configurable vertexZcut{"vertexZ", 10.f, "Vertex Z"}; - Configurable cEtacut{"cEta", 0.8, "Eta cut"}; - Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; - Configurable cPtmaxcut{"cPtmaxcut", 5.0, "Pt max cut"}; - Configurable cDcaXYcut{"cDcaXYcut", 0.12, "DCA XY cut"}; - Configurable cDcaZcut{"cDcaZcut", 0.3, "DCA Z cut"}; - Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; - Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; - Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; - Configurable cITSchicut{"cITSchi2clustercut", 70, "ITS chi2 cluster cut"}; - Configurable cTPCchicut{"cTPCchi2clustercut", 70, "TPC chi2 cluster cut"}; + Configurable vertexZcut{"vertexZcut", 10.f, "Vertex Z"}; + Configurable etaCut{"etaCut", 0.8, "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"}; // Event selections Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 @@ -180,26 +177,26 @@ struct NetchargeFluctuations { const AxisSpec etaAxis = {20, -1., 1., "#eta"}; const AxisSpec centAxis = {100, 0., 100., "centrality"}; const AxisSpec multAxis = {200, 0., 10000., "FT0M Amplitude"}; - const AxisSpec TPCChi2Axis = {140, 0., 7., "Chi2"}; - const AxisSpec ITSChi2Axis = {80, 0., 40., "Chi2"}; - const AxisSpec CrossedrowTPCAxis = {160, 0., 160., "TPC Crossed rows"}; + const AxisSpec tpcChiAxis = {140, 0., 7., "Chi2"}; + const AxisSpec itsChiAxis = {80, 0., 40., "Chi2"}; + const AxisSpec crossedRowAxis = {160, 0., 160., "TPC Crossed rows"}; const AxisSpec eventsAxis = {10, 0, 10, ""}; const AxisSpec signAxis = {20, -10, 10, ""}; histogramRegistry.add("hVtxZ_before", "", kTH1F, {vtxzAxis}); histogramRegistry.add("hDcaXY_before", "", kTH1F, {dcaAxis}); histogramRegistry.add("hDcaZ_before", "", kTH1F, {dcazAxis}); - histogramRegistry.add("hTPCchi2perCluster_before", "", kTH1D, {TPCChi2Axis}); - histogramRegistry.add("hITSchi2perCluster_before", "", kTH1D, {ITSChi2Axis}); - histogramRegistry.add("hTPCCrossedrows_before", "", kTH1D, {CrossedrowTPCAxis}); + histogramRegistry.add("hTPCchi2perCluster_before", "", kTH1D, {tpcChiAxis}); + histogramRegistry.add("hITSchi2perCluster_before", "", kTH1D, {itsChiAxis}); + histogramRegistry.add("hTPCCrossedrows_before", "", kTH1D, {crossedRowAxis}); histogramRegistry.add("hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); histogramRegistry.add("hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); histogramRegistry.add("hVtxZ_after", "", kTH1F, {vtxzAxis}); histogramRegistry.add("hDcaXY_after", "", kTH1F, {dcaAxis}); histogramRegistry.add("hDcaZ_after", "", kTH1F, {dcazAxis}); - histogramRegistry.add("hTPCchi2perCluster_after", "", kTH1D, {TPCChi2Axis}); - histogramRegistry.add("hITSchi2perCluster_after", "", kTH1D, {ITSChi2Axis}); - histogramRegistry.add("hTPCCrossedrows_after", "", kTH1D, {CrossedrowTPCAxis}); + histogramRegistry.add("hTPCchi2perCluster_after", "", kTH1D, {tpcChiAxis}); + histogramRegistry.add("hITSchi2perCluster_after", "", kTH1D, {itsChiAxis}); + histogramRegistry.add("hTPCCrossedrows_after", "", kTH1D, {crossedRowAxis}); histogramRegistry.add("hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); histogramRegistry.add("hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); histogramRegistry.add("hEta", "", kTH1F, {etaAxis}); @@ -210,16 +207,16 @@ struct NetchargeFluctuations { histogramRegistry.add("gen_hVtxZ_before", "", kTH1F, {vtxzAxis}); histogramRegistry.add("rec_hDcaXY_before", "", kTH1D, {dcaAxis}); histogramRegistry.add("rec_hDcaZ_before", "", kTH1D, {dcazAxis}); - histogramRegistry.add("rec_hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {TPCChi2Axis}); - histogramRegistry.add("rec_hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {ITSChi2Axis}); - histogramRegistry.add("rec_hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); + histogramRegistry.add("rec_hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {tpcChiAxis}); + histogramRegistry.add("rec_hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {itsChiAxis}); + histogramRegistry.add("rec_hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {crossedRowAxis}); histogramRegistry.add("rec_hVtxZ_after", "", kTH1F, {vtxzAxis}); histogramRegistry.add("gen_hVtxZ_after", "", kTH1F, {vtxzAxis}); histogramRegistry.add("rec_hDcaXY_after", "", kTH1D, {dcaAxis}); histogramRegistry.add("rec_hDcaZ_after", "", kTH1D, {dcazAxis}); - histogramRegistry.add("rec_hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {TPCChi2Axis}); - histogramRegistry.add("rec_hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {ITSChi2Axis}); - histogramRegistry.add("rec_hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); + histogramRegistry.add("rec_hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {tpcChiAxis}); + histogramRegistry.add("rec_hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {itsChiAxis}); + histogramRegistry.add("rec_hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {crossedRowAxis}); histogramRegistry.add("gen_hEta", "", kTH1F, {etaAxis}); histogramRegistry.add("rec_hEta", "", kTH1F, {etaAxis}); histogramRegistry.add("gen_hSign", "", kTH1F, {signAxis}); @@ -288,31 +285,31 @@ struct NetchargeFluctuations { return false; } // accept only global tracks - if (std::fabs(track.dcaXY()) > cDcaXYcut) { + if (std::fabs(track.dcaXY()) > dcaXYCut) { return false; } - if (std::fabs(track.dcaZ()) > cDcaZcut) { + if (std::fabs(track.dcaZ()) > dcaZCut) { return false; } - if (std::fabs(track.eta()) >= cEtacut) { + if (std::fabs(track.eta()) >= etaCut) { return false; } - if (track.pt() <= cPtmincut || track.pt() >= cPtmaxcut) { + if (track.pt() <= ptMinCut || track.pt() >= ptMaxCut) { return false; } - if (track.tpcNClsCrossedRows() < cTPCcrosscut) { + if (track.tpcNClsCrossedRows() < tpcCrossCut) { return false; } - if (track.itsChi2NCl() > cITSchicut) { + if (track.itsChi2NCl() > itsChiCut) { return false; } - if (track.tpcChi2NCl() > cTPCchicut) { + if (track.tpcChi2NCl() > tpcChiCut) { return false; } @@ -369,7 +366,7 @@ struct NetchargeFluctuations { } posneg = fpos * fneg; - net_charge(fpos, fneg, fpos * fpos, fneg * fneg, termp, termn, posneg, cent); + netCharge(fpos, fneg, fpos * fpos, fneg * fneg, termp, termn, posneg, cent); } // tracks return; @@ -425,8 +422,8 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("rec_hCentrality"), cent); histogramRegistry.fill(HIST("rec_hMultiplicity"), mult); - int fpos_rec = 0, fneg_rec = 0, posneg_rec = 0, termn_rec = 0, termp_rec = 0; - int fpos_gen = 0, fneg_gen = 0, posneg_gen = 0, termn_gen = 0, termp_gen = 0; + int posRec = 0, negRec = 0, posNegRec = 0, termNRec = 0, termPRec = 0; + int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0; const auto& mccolgen = coll.template mcCollision_as(); if (std::abs(mccolgen.posZ()) > vertexZcut) { @@ -439,13 +436,13 @@ struct NetchargeFluctuations { for (const auto& track : inputTracks) { if (!track.isGlobalTrack()) continue; - if (std::fabs(track.dcaXY()) > cDcaXYcut) + if (std::fabs(track.dcaXY()) > dcaXYCut) continue; - if (std::fabs(track.dcaZ()) > cDcaZcut) + if (std::fabs(track.dcaZ()) > dcaZCut) continue; - if (std::fabs(track.eta()) > cEtacut) + if (std::fabs(track.eta()) > etaCut) continue; - if ((track.pt() <= cPtmincut) || (track.pt() >= cPtmaxcut)) + if ((track.pt() <= ptMinCut) || (track.pt() >= ptMaxCut)) continue; if (track.sign() == 0) { continue; @@ -455,19 +452,19 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("rec_hEta"), track.eta()); if (track.sign() == 1) { - fpos_rec += 1; - termp_rec = fpos_rec * (fpos_rec - 1); + posRec += 1; + termPRec = posRec * (posRec - 1); } if (track.sign() == -1) { - fneg_rec += 1; - termn_rec = fneg_rec * (fneg_rec - 1); + negRec += 1; + termNRec = negRec * (negRec - 1); } - posneg_rec = fpos_rec * fneg_rec; + posNegRec = posRec * negRec; - netChargeRec(fpos_rec, fneg_rec, fpos_rec * fpos_rec, fneg_rec * fneg_rec, - termp_rec, termn_rec, posneg_rec, cent); + netChargeRec(posRec, negRec, posRec * posRec, negRec * negRec, + termPRec, termNRec, posNegRec, cent); } // loop over inputTracks (reco) for (const auto& mcpart : mcpartgen) { @@ -489,28 +486,28 @@ struct NetchargeFluctuations { } - if (std::fabs(mcpart.eta()) > cEtacut) + if (std::fabs(mcpart.eta()) > etaCut) continue; - if ((mcpart.pt() <= cPtmincut) || (mcpart.pt() >= cPtmaxcut)) + if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) continue; histogramRegistry.fill(HIST("gen_hPt"), mcpart.pt()); histogramRegistry.fill(HIST("gen_hEta"), mcpart.eta()); histogramRegistry.fill(HIST("gen_hSign"), sign); if (sign == 1) { - fpos_gen += 1; - termp_gen = fpos_gen * (fpos_gen - 1); + posGen += 1; + termPGen = posGen * (posGen - 1); } if (sign == -1) { - fneg_gen += 1; - termn_gen = fneg_gen * (fneg_gen - 1); + negGen += 1; + termNGen = negGen * (negGen - 1); } - posneg_gen = fpos_gen * fneg_gen; + posNegGen = posGen * negGen; - net_charge_gen(fpos_gen, fneg_gen, fpos_gen * fpos_gen, fneg_gen * fneg_gen, - termp_gen, termn_gen, posneg_gen, cent); + netChargeGen(posGen, negGen, posGen * posGen, negGen * negGen, + termPGen, termNGen, posNegGen, cent); } // particle } // void @@ -551,10 +548,10 @@ struct NetchargeFluctuations { }; // struct struct NetchargeAnalysis { - Configurable cfgNSubsample{"cfgNSubsample", 20, "Number of subsamples"}; + Configurable cfSubSample{"cfSubSample", 20, "Number of subsamples"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; std::vector>> net; - std::vector>> Subsample; + std::vector>> subSample; TRandom3* fRndm = new TRandom3(0); void init(o2::framework::InitContext&) @@ -570,17 +567,17 @@ struct NetchargeAnalysis { registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - Subsample.resize(cfgNSubsample); - - for (int i = 0; i < cfgNSubsample; ++i) { - Subsample[i].resize(7); - Subsample[i][0] = std::get>(registry.add(Form("Subsample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][1] = std::get>(registry.add(Form("Subsample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][2] = std::get>(registry.add(Form("Subsample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][3] = std::get>(registry.add(Form("Subsample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][4] = std::get>(registry.add(Form("Subsample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][5] = std::get>(registry.add(Form("Subsample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][6] = std::get>(registry.add(Form("Subsample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample.resize(cfSubSample); + + for (int i = 0; i < cfSubSample; ++i) { + subSample[i].resize(7); + subSample[i][0] = std::get>(registry.add(Form("subSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][1] = std::get>(registry.add(Form("subSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][2] = std::get>(registry.add(Form("subSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][3] = std::get>(registry.add(Form("subSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][4] = std::get>(registry.add(Form("subSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][5] = std::get>(registry.add(Form("subSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][6] = std::get>(registry.add(Form("subSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); } } // void @@ -589,30 +586,30 @@ struct NetchargeAnalysis { { registry.get(HIST("pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); registry.get(HIST("neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - registry.get(HIST("termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termpCharge()); - registry.get(HIST("termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termnCharge()); - registry.get(HIST("pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.possqCharge()); - registry.get(HIST("neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negsqCharge()); - registry.get(HIST("posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posnegCharge()); - - int SampleIndex = static_cast(cfgNSubsample * fRndm->Rndm()); - Subsample[SampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - Subsample[SampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - Subsample[SampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termpCharge()); - Subsample[SampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termnCharge()); - Subsample[SampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.possqCharge()); - Subsample[SampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negsqCharge()); - Subsample[SampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posnegCharge()); + registry.get(HIST("termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); + registry.get(HIST("termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); + registry.get(HIST("pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); + registry.get(HIST("neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); + registry.get(HIST("posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); + + int sampleIndex = static_cast(cfSubSample * fRndm->Rndm()); + subSample[sampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); + subSample[sampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); + subSample[sampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); + subSample[sampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); + subSample[sampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); + subSample[sampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); + subSample[sampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); } // void }; // struct Netcharge_analysis struct NetchargeAnalysisRec { - Configurable cfgNSubsample{"cfgNSubsample", 20, "Number of subsamples"}; + Configurable cfSubSample{"cfSubSample", 20, "Number of subsamples"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; std::vector>> net; - std::vector>> Subsample; + std::vector>> subSample; TRandom3* fRndm = new TRandom3(0); void init(o2::framework::InitContext&) @@ -628,19 +625,19 @@ struct NetchargeAnalysisRec { registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - Subsample.resize(cfgNSubsample); - for (int i = 0; i < cfgNSubsample; i++) { - Subsample[i].resize(7); + subSample.resize(cfSubSample); + for (int i = 0; i < cfSubSample; i++) { + subSample[i].resize(7); } - for (int i = 0; i < cfgNSubsample; i++) { - Subsample[i][0] = std::get>(registry.add(Form("Subsample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][1] = std::get>(registry.add(Form("Subsample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][2] = std::get>(registry.add(Form("Subsample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][3] = std::get>(registry.add(Form("Subsample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][4] = std::get>(registry.add(Form("Subsample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][5] = std::get>(registry.add(Form("Subsample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][6] = std::get>(registry.add(Form("Subsample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + for (int i = 0; i < cfSubSample; i++) { + subSample[i][0] = std::get>(registry.add(Form("subSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][1] = std::get>(registry.add(Form("subSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][2] = std::get>(registry.add(Form("subSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][3] = std::get>(registry.add(Form("subSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][4] = std::get>(registry.add(Form("subSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][5] = std::get>(registry.add(Form("subSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][6] = std::get>(registry.add(Form("subSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); } } // void @@ -648,30 +645,30 @@ struct NetchargeAnalysisRec { { registry.get(HIST("pos_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posCharge()); registry.get(HIST("neg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.negCharge()); - registry.get(HIST("termp_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termpCharge()); - registry.get(HIST("termn_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termnCharge()); - registry.get(HIST("pos_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.possqCharge()); - registry.get(HIST("neg_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.negsqCharge()); - registry.get(HIST("posneg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posnegCharge()); - - float l_Random = fRndm->Rndm(); - int SampleIndex = static_cast(cfgNSubsample * l_Random); - Subsample[SampleIndex][0]->Fill(rec_netcharge.centrality(), rec_netcharge.posCharge()); - Subsample[SampleIndex][1]->Fill(rec_netcharge.centrality(), rec_netcharge.negCharge()); - Subsample[SampleIndex][2]->Fill(rec_netcharge.centrality(), rec_netcharge.termpCharge()); - Subsample[SampleIndex][3]->Fill(rec_netcharge.centrality(), rec_netcharge.termnCharge()); - Subsample[SampleIndex][4]->Fill(rec_netcharge.centrality(), rec_netcharge.possqCharge()); - Subsample[SampleIndex][5]->Fill(rec_netcharge.centrality(), rec_netcharge.negsqCharge()); - Subsample[SampleIndex][6]->Fill(rec_netcharge.centrality(), rec_netcharge.posnegCharge()); + registry.get(HIST("termp_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termPCharge()); + registry.get(HIST("termn_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termNCharge()); + registry.get(HIST("pos_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posSqCharge()); + registry.get(HIST("neg_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.negSqCharge()); + registry.get(HIST("posneg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posNegCharge()); + + float randValue = fRndm->Rndm(); + int sampleIndex = static_cast(cfSubSample * randValue); + subSample[sampleIndex][0]->Fill(rec_netcharge.centrality(), rec_netcharge.posCharge()); + subSample[sampleIndex][1]->Fill(rec_netcharge.centrality(), rec_netcharge.negCharge()); + subSample[sampleIndex][2]->Fill(rec_netcharge.centrality(), rec_netcharge.termPCharge()); + subSample[sampleIndex][3]->Fill(rec_netcharge.centrality(), rec_netcharge.termNCharge()); + subSample[sampleIndex][4]->Fill(rec_netcharge.centrality(), rec_netcharge.posSqCharge()); + subSample[sampleIndex][5]->Fill(rec_netcharge.centrality(), rec_netcharge.negSqCharge()); + subSample[sampleIndex][6]->Fill(rec_netcharge.centrality(), rec_netcharge.posNegCharge()); } // void }; // struct rec struct NetchargeAnalysisGen { - Configurable cfgNSubsample{"cfgNSubsample", 20, "Number of subsamples"}; + Configurable cfSubSample{"cfSubSample", 20, "Number of subsamples"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; std::vector>> net; - std::vector>> Subsample; + std::vector>> subSample; TRandom3* fRndm = new TRandom3(0); void init(o2::framework::InitContext&) @@ -687,19 +684,19 @@ struct NetchargeAnalysisGen { registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - Subsample.resize(cfgNSubsample); - for (int i = 0; i < cfgNSubsample; i++) { - Subsample[i].resize(7); + subSample.resize(cfSubSample); + for (int i = 0; i < cfSubSample; i++) { + subSample[i].resize(7); } - for (int i = 0; i < cfgNSubsample; i++) { - Subsample[i][0] = std::get>(registry.add(Form("Subsample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][1] = std::get>(registry.add(Form("Subsample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][2] = std::get>(registry.add(Form("Subsample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][3] = std::get>(registry.add(Form("Subsample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][4] = std::get>(registry.add(Form("Subsample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][5] = std::get>(registry.add(Form("Subsample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - Subsample[i][6] = std::get>(registry.add(Form("Subsample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + for (int i = 0; i < cfSubSample; i++) { + subSample[i][0] = std::get>(registry.add(Form("subSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][1] = std::get>(registry.add(Form("subSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][2] = std::get>(registry.add(Form("subSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][3] = std::get>(registry.add(Form("subSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][4] = std::get>(registry.add(Form("subSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][5] = std::get>(registry.add(Form("subSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][6] = std::get>(registry.add(Form("subSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); } } // void @@ -707,21 +704,21 @@ struct NetchargeAnalysisGen { { registry.get(HIST("pos_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posCharge()); registry.get(HIST("neg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.negCharge()); - registry.get(HIST("termp_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termpCharge()); - registry.get(HIST("termn_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termnCharge()); - registry.get(HIST("pos_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.possqCharge()); - registry.get(HIST("neg_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.negsqCharge()); - registry.get(HIST("posneg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posnegCharge()); - - float l_Random = fRndm->Rndm(); - int SampleIndex = static_cast(cfgNSubsample * l_Random); - Subsample[SampleIndex][0]->Fill(gen_netcharge.centrality(), gen_netcharge.posCharge()); - Subsample[SampleIndex][1]->Fill(gen_netcharge.centrality(), gen_netcharge.negCharge()); - Subsample[SampleIndex][2]->Fill(gen_netcharge.centrality(), gen_netcharge.termpCharge()); - Subsample[SampleIndex][3]->Fill(gen_netcharge.centrality(), gen_netcharge.termnCharge()); - Subsample[SampleIndex][4]->Fill(gen_netcharge.centrality(), gen_netcharge.possqCharge()); - Subsample[SampleIndex][5]->Fill(gen_netcharge.centrality(), gen_netcharge.negsqCharge()); - Subsample[SampleIndex][6]->Fill(gen_netcharge.centrality(), gen_netcharge.posnegCharge()); + registry.get(HIST("termp_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termPCharge()); + registry.get(HIST("termn_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termNCharge()); + registry.get(HIST("pos_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posSqCharge()); + registry.get(HIST("neg_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.negSqCharge()); + registry.get(HIST("posneg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posNegCharge()); + + float randValue = fRndm->Rndm(); + int sampleIndex = static_cast(cfSubSample * randValue); + subSample[sampleIndex][0]->Fill(gen_netcharge.centrality(), gen_netcharge.posCharge()); + subSample[sampleIndex][1]->Fill(gen_netcharge.centrality(), gen_netcharge.negCharge()); + subSample[sampleIndex][2]->Fill(gen_netcharge.centrality(), gen_netcharge.termPCharge()); + subSample[sampleIndex][3]->Fill(gen_netcharge.centrality(), gen_netcharge.termNCharge()); + subSample[sampleIndex][4]->Fill(gen_netcharge.centrality(), gen_netcharge.posSqCharge()); + subSample[sampleIndex][5]->Fill(gen_netcharge.centrality(), gen_netcharge.negSqCharge()); + subSample[sampleIndex][6]->Fill(gen_netcharge.centrality(), gen_netcharge.posNegCharge()); } // void }; // struct From 46469a9f2df15768bc982a41e95c272224f43b57 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 4 Jun 2025 14:36:54 +0530 Subject: [PATCH 06/14] cfnetchargfluc --- .../Tasks/netchargeFluctuations.cxx | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 5118d151509..1218c8f6b9a 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -10,8 +10,8 @@ // or submit itself to any jurisdiction. /// \file netchargeFluctuations.cxx -/// \brief Calculate nu_dyn fluctuations -/// For charged particles +/// \brief Calculate nu_dyn fluctuations +/// For charged particles /// For RUN-3 /// /// \author Nida Malik @@ -47,9 +47,12 @@ using namespace o2::framework::expressions; using namespace std; using namespace o2::constants::physics; -namespace o2{ -namespace aod{ -namespace net_charge{ +namespace o2 +{ +namespace aod +{ +namespace net_charge +{ DECLARE_SOA_COLUMN(PosCharge, posCharge, float); DECLARE_SOA_COLUMN(NegCharge, negCharge, float); DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); @@ -60,7 +63,8 @@ DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); } // namespace net_charge -namespace net_charge_rec{ +namespace net_charge_rec +{ DECLARE_SOA_COLUMN(PosCharge, posCharge, float); DECLARE_SOA_COLUMN(NegCharge, negCharge, float); DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); @@ -71,7 +75,8 @@ DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); } // namespace net_charge_rec -namespace net_charge_gen{ +namespace net_charge_gen +{ DECLARE_SOA_COLUMN(PosCharge, posCharge, float); DECLARE_SOA_COLUMN(NegCharge, negCharge, float); DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); @@ -127,7 +132,7 @@ using MyMCCollisionRun3 = MyMCCollisionsRun3::iterator; using MyMCTracks = soa::Join; using MyMCTrack = MyMCTracks::iterator; -} //aod +} // namespace aod } // namespace o2 enum RunType { @@ -464,7 +469,7 @@ struct NetchargeFluctuations { posNegRec = posRec * negRec; netChargeRec(posRec, negRec, posRec * posRec, negRec * negRec, - termPRec, termNRec, posNegRec, cent); + termPRec, termNRec, posNegRec, cent); } // loop over inputTracks (reco) for (const auto& mcpart : mcpartgen) { @@ -480,12 +485,11 @@ struct NetchargeFluctuations { if (sign == 0) { continue; } - //auto pdgServicecode = mcpart.pdgCode(); - if (std::abs(pid) != kElectron && std::abs(pid) != kMuonMinus && std::abs(pid) != kPiPlus && std::abs(pid) != kKPlus && std::abs(pid) != kProton) { - continue; - - } - + // auto pdgServicecode = mcpart.pdgCode(); + if (std::abs(pid) != kElectron && std::abs(pid) != kMuonMinus && std::abs(pid) != kPiPlus && std::abs(pid) != kKPlus && std::abs(pid) != kProton) { + continue; + } + if (std::fabs(mcpart.eta()) > etaCut) continue; if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) @@ -507,7 +511,7 @@ struct NetchargeFluctuations { posNegGen = posGen * negGen; netChargeGen(posGen, negGen, posGen * posGen, negGen * negGen, - termPGen, termNGen, posNegGen, cent); + termPGen, termNGen, posNegGen, cent); } // particle } // void From c9970a6e378d721a4b2c1b6581972e85d9e15e2b Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 4 Jun 2025 14:44:18 +0530 Subject: [PATCH 07/14] cfnetchargfluc --- PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 1218c8f6b9a..9f1a0e0b989 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -29,7 +29,6 @@ #include "Common/DataModel/FT0Corrected.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" #include "Framework/RunningWorkflowInfo.h" #include "PWGCF/Core/CorrelationContainer.h" #include "PWGCF/Core/PairCuts.h" @@ -40,6 +39,7 @@ #include "TProfile.h" #include "TProfile2D.h" #include "TRandom3.h" +#include // Include for std::vector using namespace o2; using namespace o2::framework; From 066bb7c4d668e492a3c765e88fa56996246c772d Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 4 Jun 2025 14:49:50 +0530 Subject: [PATCH 08/14] cfnetchargfluc --- PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 9f1a0e0b989..d2231a60e5b 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -15,6 +15,8 @@ /// For RUN-3 /// /// \author Nida Malik +#include // Include for std::vector + #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Common/DataModel/EventSelection.h" @@ -39,7 +41,6 @@ #include "TProfile.h" #include "TProfile2D.h" #include "TRandom3.h" -#include // Include for std::vector using namespace o2; using namespace o2::framework; From 94b3b5048c054a88d677b1eedbc8d1db5ce4e33d Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 4 Jun 2025 15:49:38 +0530 Subject: [PATCH 09/14] cfnetchargfluc --- 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 d2231a60e5b..3d9c379962e 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -379,7 +379,7 @@ struct NetchargeFluctuations { } template - void histogramRegistryMcRecoGen(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles) + void histosMcRecoGen(C const& coll, T const& inputTracks, [[maybe_unused]] M const& mcCollisions, P const& mcParticles) { if (!coll.has_mcCollision()) { return; @@ -537,7 +537,7 @@ struct NetchargeFluctuations { void processMcRun3(aod::MyMCCollisionRun3 const& coll, aod::MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - histogramRegistryMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); + histosMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); } PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", true); @@ -545,7 +545,7 @@ struct NetchargeFluctuations { void processMcRun2(aod::MyMCCollisionRun2 const& coll, aod::MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - histogramRegistryMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); + histosMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); } PROCESS_SWITCH(NetchargeFluctuations, processMcRun2, "Process reconstructed", false); From abab43dc136db40aaddbb66ece594f204fb4163c Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Wed, 4 Jun 2025 16:27:43 +0530 Subject: [PATCH 10/14] cfnetchargfluc --- PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 3d9c379962e..a2eeee342ed 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -379,8 +379,9 @@ struct NetchargeFluctuations { } template - void histosMcRecoGen(C const& coll, T const& inputTracks, [[maybe_unused]] M const& mcCollisions, P const& mcParticles) + void histosMcRecoGen(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles) { + (void)mcCollisions; if (!coll.has_mcCollision()) { return; } From dab3d2e4e8ab6dce66a27eec04f9176965aef2b6 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Thu, 5 Jun 2025 18:15:42 +0530 Subject: [PATCH 11/14] cfnetchargfluctu --- .../Tasks/IdentifiedMeanPtFluctuations.cxx | 1762 ++++++++++------- .../Tasks/netchargeFluctuations.cxx | 231 +-- 2 files changed, 1089 insertions(+), 904 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/IdentifiedMeanPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/IdentifiedMeanPtFluctuations.cxx index 2217a2c1f4f..f4da22e1c87 100644 --- a/PWGCF/EbyEFluctuations/Tasks/IdentifiedMeanPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/IdentifiedMeanPtFluctuations.cxx @@ -1,3 +1,19 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// author Sweta Singh (sweta.singh@cern.ch) +// Department of Physics, Aligarh Muslim University, India +// to study the two particle correaltor on Run 3data + + // Copyright 2019-2020 CERN and copyright holders of ALICE O2. // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. // All rights not expressly granted are reserved. @@ -10,6 +26,7 @@ // or submit itself to any jurisdiction. /// \author Sweta Singh (sweta.singh@cern.ch) +// Mean pT fluctautions usin #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -32,35 +49,40 @@ #include "TDatabasePDG.h" #include #include "Common/CCDB/TriggerAliases.h" +#include "CCDB/BasicCCDBManager.h" +#include "Framework/O2DatabasePDGPlugin.h" + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace std; +#include +#include +#include +#include + namespace o2::aod { - -using MyCollisions = soa::Join; -using MyTracks = soa::Join; +using MyTracks = soa::Join; + aod::pidTOFFullKa, aod::pidTOFFullPr, aod::pidTOFFullDe, aod::pidTOFbeta, aod::TOFSignal, aod::TracksExtra, aod::TracksIU, aod::TracksDCA, aod::TrackSelection>; -using MyMCRecoCollisions = soa::Join; +using MyMCRecoCollisions = soa::Join; +using MyMCRecoCollision = MyMCRecoCollisions::iterator; using MyMCRecoTracks = soa::Join; + aod::pidTOFFullKa, aod::pidTOFFullPr, aod::pidTOFFullDe, aod::pidTOFbeta, aod::TOFSignal, aod::TracksExtra, aod::TracksIU, aod::TracksDCA, aod::TrackSelection, aod::McTrackLabels>; +using MyMCRecoTrack = MyMCRecoTracks::iterator; +using EventCandidatesMC = soa::Join; using MyCollision = MyCollisions::iterator; using MyTrack = MyTracks::iterator; } // namespace o2::aod @@ -69,22 +91,34 @@ double massPi = TDatabasePDG::Instance()->GetParticle(211)->Mass(); double massKa = TDatabasePDG::Instance()->GetParticle(321)->Mass(); double massPr = TDatabasePDG::Instance()->GetParticle(2212)->Mass(); -struct IdentifiedMeanPtFluctuations { - +struct IdentifiedMeanPtFluctuations{ + Service ccdb; + Service pdg; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable ptMax{"ptMax", 2.0, "maximum pT"}; + Configurable ptMin{"ptMin", 0.15, "minimum pT"}; + Configurable> ptBins{"ptBins", {0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.05, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00}, "p_{T} bins"}; + + Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; void init(o2::framework::InitContext&) { - AxisSpec vtxZAxis = {100, -20, 20, "Z (cm)"}; + + + std::vector ptBinning = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0}; + // AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec vtxZAxis = {100, -20.0, 20.0, "Z (cm)"}; AxisSpec dcaAxis = {1002, -5.01, 5.01, "DCA_{xy} (cm)"}; AxisSpec dcazAxis = {1002, -5.01, 5.01, "DCA_{z} (cm)"}; - AxisSpec ptAxis = {400, 0.0, 4.0, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxis = {600, 0.0, 6.0, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec pAxis = {400, 0.0, 4.0, "#it{p} (GeV/#it{c})"}; AxisSpec betaAxis = {200, 0.0, 2.0, "TOF_{#beta} (GeV/#it{c})"}; AxisSpec dEdxAxis = {2000, 0.0, 200.0, "dE/dx (GeV/#it{c})"}; - AxisSpec etaAxis = {100, -1.5, 1.5, "#eta"}; + AxisSpec etaAxis = {300, -1.5, 1.5, "#eta"};// 300, -1.5, 1.5 AxisSpec nSigmaTPCAxis = {170, -8.5, 8.5, "n#sigma_{TPC}^{proton}"}; AxisSpec nSigmaTPCAxispid = {170, -8.5, 8.5, "n#sigma_{TPC}"}; AxisSpec nSigmaTOFAxispid = {170, -8.5, 8.5, "n#sigma_{TOF}"}; @@ -123,27 +157,146 @@ struct IdentifiedMeanPtFluctuations { h_rec->GetXaxis()->SetBinLabel(6, "klsGoodZvtxFT0vsPV passed"); h_rec->GetXaxis()->SetBinLabel(7, "klsVertexITSTPC passed"); - histos.add("hZvtx_before_sel", "hZvtx_before_sel", kTH1D, {vtxZAxis}); - histos.add("hZvtx_after_sel", "hZvtx_after_sel", kTH1D, {vtxZAxis}); - histos.add("hZvtx_after_sel8", "hZvtx_after_sel8", kTH1D, {vtxZAxis}); - histos.add("hP", "hP", kTH1D, {pAxis}); - histos.add("hEta", ";hEta", kTH1D, {etaAxis}); - histos.add("hPt", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("hNsigmaTPC", "hNsigmaTPC", kTH2D, - {pAxis, nSigmaTPCAxis}); - histos.add("hDCAxy", "hDCAxy", kTH1D, {dcaAxis}); - histos.add("hDCAz", "hDCAz", kTH1D, {dcazAxis}); - - histos.add("hPtDCAxy", "hPtDCAxy", kTH2D, {ptAxis, dcaAxis}); - histos.add("hPtDCAz", "hPtDCAz", kTH2D, {ptAxis, dcazAxis}); - histos.add("NSigamaTPCpion", "NSigamaTPCpion", kTH2D, {ptAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCkaon", "NSigamaTPCkaon", kTH2D, {ptAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCproton", "NSigamaTPCproton", kTH2D, {ptAxis, nSigmaTPCAxispid}); - - histos.add("NSigamaTOFpion", "NSigamaTOFpion", kTH2D, {ptAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFkaon", "NSigamaTOFkaon", kTH2D, {ptAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFproton", "NSigamaTOFproton", kTH2D, {ptAxis, nSigmaTOFAxispid}); + histos.add("Data/hZvtx_before_sel", "hZvtx_before_sel", kTH1D, {vtxZAxis}); + histos.add("Data/hZvtx_after_sel", "hZvtx_after_sel", kTH1D, {vtxZAxis}); + histos.add("Data/hZvtx_after_sel8", "hZvtx_after_sel8", kTH1D, {vtxZAxis}); + histos.add("Data/hP", "hP", kTH1D, {pAxis}); + histos.add("Data/hEta", ";hEta", kTH1D, {etaAxis}); + histos.add("Data/hPt", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); + histos.add("Data/hNsigmaTPC", "hNsigmaTPC", kTH2D, {pAxis, nSigmaTPCAxis}); + histos.add("Data/hDCAxy", "hDCAxy", kTH1D, {dcaAxis}); + histos.add("Data/hDCAz", "hDCAz", kTH1D, {dcazAxis}); + + histos.add("Data/hPtDCAxy", "hPtDCAxy", kTH2D, {ptAxis, dcaAxis}); + histos.add("Data/hPtDCAz", "hPtDCAz", kTH2D, {ptAxis, dcazAxis}); + histos.add("Data/NSigamaTPCpion", "NSigamaTPCpion", kTH2D, {ptAxis, nSigmaTPCAxispid}); + histos.add("Data/NSigamaTPCkaon", "NSigamaTPCkaon", kTH2D, {ptAxis, nSigmaTPCAxispid}); + histos.add("Data/NSigamaTPCproton", "NSigamaTPCproton", kTH2D, {ptAxis, nSigmaTPCAxispid}); + + histos.add("Data/NSigamaTOFpion", "NSigamaTOFpion", kTH2D, {ptAxis, nSigmaTOFAxispid}); + histos.add("Data/NSigamaTOFkaon", "NSigamaTOFkaon", kTH2D, {ptAxis, nSigmaTOFAxispid}); + histos.add("Data/NSigamaTOFproton", "NSigamaTOFproton", kTH2D, {ptAxis, nSigmaTOFAxispid}); + + histos.add("Data/NSigamaTPCTOFpion", "NSigamaTPCTOFpion", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); + histos.add("Data/NSigamaTPCTOFkaon", "NSigamaTPCTOFkaon", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); + histos.add("Data/NSigamaTPCTOFproton", "NSigamaTPCTOFproton", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); + + histos.add("Data/hPtPion", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); + histos.add("Data/hPtKaon", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); + histos.add("Data/hPtProton", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); + + histos.add("Data/hEtaPion", ";hEta", kTH1D, {etaAxis}); + histos.add("Data/hEtaKaon", ";hEta", kTH1D, {etaAxis}); + histos.add("Data/hEtaProton", ";hEta", kTH1D, {etaAxis}); + //=====================rapidity===================================== + histos.add("Data/hyPion", ";hyPion", kTH1D, {etaAxis}); + histos.add("Data/hyKaon", ";hyKaon", kTH1D, {etaAxis}); + histos.add("Data/hyProton", ";hyProton", kTH1D, {etaAxis}); + + histos.add("Data/hPtCh", "hPtCh", kTH2D, {nchAxis, ptAxis}); + histos.add("Data/hPtChPion", "hPtChPion", kTH2D, {nchAxis, ptAxis}); + histos.add("Data/hPtChKaon", "hPtChKaon", kTH2D, {nchAxis, ptAxis}); + histos.add("Data/hPtChProton", "hPtChProton", kTH2D, {nchAxis, ptAxis}); + + histos.add("Data/hPtCent", "hPtCent", kTH2D, {centAxis, ptAxis}); + histos.add("Data/hPtCentPion", "hPtCentPion", kTH2D, {centAxis, ptAxis}); + histos.add("Data/hPtCentKaon", "hPtCentKaon", kTH2D, {centAxis, ptAxis}); + histos.add("Data/hPtCentProton", "hPtCentProton", kTH2D, {centAxis, ptAxis}); + + histos.add("Data/hMeanPtCh", "hMeanPtCh", kTH2D, {nchAxis, ptAxis}); + histos.add("Data/hCent", "hCent", kTH2D, {nchAxis, centAxis}); + + histos.add("Data/hVar1", "hVar1", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2", "hVar2", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2meanpt", "hVar2meanpt", kTH2D, {centAxis, varAxis2}); + histos.add("Data/hVar", "hVar", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVarc", "hVarc", kTH2D, {subAxis, centAxis}); + + histos.add("Data/hVar1pi", "hVar1pi", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2pi", "hVar2pi", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVarpi", "hVarpi", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2meanptpi", "hVar2meanptpi", kTH2D, {centAxis, varAxis2}); + + histos.add("Data/hVar1k", "hVar1k", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2k", "hVar2k", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVark", "hVark", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2meanptk", "hVar2meanptk", kTH2D, {centAxis, varAxis2}); + + histos.add("Data/hVar1p", "hVar1p", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2p", "hVar2p", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVarp", "hVarp", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2meanptp", "hVar2meanptp", kTH2D, {centAxis, varAxis2}); + + //--------------------------------nch---------------------------------- + + histos.add("Data/hnch_all", ";hnch_all", kTH1D, {nchAxis}); + histos.add("Data/hnch_all_bf_cut", ";hnch_all_bf_cut", kTH1D, {nchAxis}); + histos.add("Data/hnch", ";hnch", kTH1D, {nchAxis}); + histos.add("Data/hnch_true", ";hnch_true", kTH1D, {nchAxis}); + histos.add("Data/hnch_true_pt", ";hnch_true_pt", kTH1D, {nchAxis}); + + + histos.add("Data/hVar1x_old", "hVar1x_old", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2x_old", "hVar2x_old", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVarx_old", "hVarx_old", kTH2D, {subAxis, nchAxis}); + + histos.add("Data/hVar1x", "hVar1x", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2x", "hVar2x", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVarx", "hVarx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2meanptx", "hVar2meanptx", kTH2D, {nchAxis, varAxis2}); + + histos.add("Data/hVar1pix", "hVar1pix", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2pix", "hVar2pix", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVarpix", "hVarpix", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2meanptpix", "hVar2meanptpix", kTH2D, {nchAxis, varAxis2}); + + histos.add("Data/hVar1kx", "hVar1kx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2kx", "hVar2kx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVarkx", "hVarkx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2meanptkx", "hVar2meanptkx", kTH2D, {nchAxis, varAxis2}); + + histos.add("Data/hVar1px", "hVar1px", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2px", "hVar2px", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVarpx", "hVarpx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2meanptpx", "hVar2meanptpx", kTH2D, {nchAxis, varAxis2}); + + histos.add("Data/ht", "ht", kTH1D, {centAxis}); + + histos.add("Data/hCentrality", "hCentrality", kTH1D, {centAxis}); + + histos.add("Data/hPEta", "hPEta", kTH2D, {pAxis, etaAxis}); + histos.add("Data/hPtEta", "hPtEta", kTH2D, {ptAxis, etaAxis}); + histos.add("Data/hPy", "hPy", kTH2D, {pAxis, etaAxis}); + histos.add("Data/hPty", "hPty", kTH2D, {ptAxis, etaAxis}); + + histos.add("Data/hPtyPion", "hPtyPion", kTH2D, {ptAxis, etaAxis}); + histos.add("Data/hPtyKaon", "hPtyKaon", kTH2D, {ptAxis, etaAxis}); + histos.add("Data/hPtyProton", "hPtyProton", kTH2D, {ptAxis, etaAxis}); + + histos.add("Data/hTOFbeta", "hTOFbeta", kTH2D, {pAxis, betaAxis}); + histos.add("Data/hdEdx", "hdEdx", kTH2D, {pAxis, dEdxAxis}); + + histos.add("Data/hTOFbeta_afterselection", "hTOFbeta_afterselection", kTH2D, {pAxis, betaAxis}); + histos.add("Data/hdEdx_afterselection", "hdEdx_afterselection", kTH2D, {pAxis, dEdxAxis}); + + histos.add("Data/hTOFbeta_afterselection1", "hTOFbeta_afterselection1", kTH2D, {pAxis, betaAxis}); + histos.add("Data/hdEdx_afterselection1", "hdEdx_afterselection1", kTH2D, {pAxis, dEdxAxis}); + + histos.add("Data/hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); + histos.add("Data/hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); + histos.add("Data/hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); + + histos.add("Data/hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); + histos.add("Data/hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); + histos.add("Data/hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); + + histos.add("Data/hdEdx_rec_bf_anycut", "hdEdx_rec_bf_anycut", kTH2D, {pAxis, dEdxAxis}); + histos.add("Data/hcent_nacc", "hcent_nacc", kTH2D, {centAxis, nchAxis}); + + + histos.addClone("Data/", "Rec/"); +//rec histograms histos.add("NSigamaTPCpion_rec", "NSigamaTPCpion_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); histos.add("NSigamaTPCkaon_rec", "NSigamaTPCkaon_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); histos.add("NSigamaTPCproton_rec", "NSigamaTPCproton_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); @@ -152,9 +305,6 @@ struct IdentifiedMeanPtFluctuations { histos.add("NSigamaTOFkaon_rec", "NSigamaTOFkaon_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); histos.add("NSigamaTOFproton_rec", "NSigamaTOFproton_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFpion", "NSigamaTPCTOFpion", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFkaon", "NSigamaTPCTOFkaon", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFproton", "NSigamaTPCTOFproton", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); histos.add("NSigamaTPCTOFpion_rec", "NSigamaTPCTOFpion_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); histos.add("NSigamaTPCTOFkaon_rec", "NSigamaTPCTOFkaon_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); @@ -172,85 +322,6 @@ struct IdentifiedMeanPtFluctuations { histos.add("NSigamaTPCTOFkaon_rec_bf_sel", "NSigamaTPCTOFkaon_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); histos.add("NSigamaTPCTOFproton_rec_bf_sel", "NSigamaTPCTOFproton_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("hPtPion", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("hPtKaon", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("hPtProton", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - - histos.add("hEtaPion", ";hEta", kTH1D, {etaAxis}); - histos.add("hEtaKaon", ";hEta", kTH1D, {etaAxis}); - histos.add("hEtaProton", ";hEta", kTH1D, {etaAxis}); - //=====================rapidity===================================== - histos.add("hyPion", ";hyPion", kTH1D, {etaAxis}); - histos.add("hyKaon", ";hyKaon", kTH1D, {etaAxis}); - histos.add("hyProton", ";hyProton", kTH1D, {etaAxis}); - - histos.add("hPtCh", "hPtCh", kTH2D, {nchAxis, ptAxis}); - histos.add("hPtChPion", "hPtChPion", kTH2D, {nchAxis, ptAxis}); - histos.add("hPtChKaon", "hPtChKaon", kTH2D, {nchAxis, ptAxis}); - histos.add("hPtChProton", "hPtChProton", kTH2D, {nchAxis, ptAxis}); - - histos.add("hPtCent", "hPtCent", kTH2D, {centAxis, ptAxis}); - histos.add("hPtCentPion", "hPtCentPion", kTH2D, {centAxis, ptAxis}); - histos.add("hPtCentKaon", "hPtCentKaon", kTH2D, {centAxis, ptAxis}); - histos.add("hPtCentProton", "hPtCentProton", kTH2D, {centAxis, ptAxis}); - - histos.add("hMeanPtCh", "hMeanPtCh", kTH2D, {nchAxis, ptAxis}); - histos.add("hCent", "hCent", kTH2D, {nchAxis, centAxis}); - - histos.add("hVar1", "hVar1", kTH2D, {subAxis, centAxis}); - histos.add("hVar2", "hVar2", kTH2D, {subAxis, centAxis}); - histos.add("hVar2meanpt", "hVar2meanpt", kTH2D, {centAxis, varAxis2}); - histos.add("hVar", "hVar", kTH2D, {subAxis, centAxis}); - histos.add("hVarc", "hVarc", kTH2D, {subAxis, centAxis}); - - histos.add("hVar1pi", "hVar1pi", kTH2D, {subAxis, centAxis}); - histos.add("hVar2pi", "hVar2pi", kTH2D, {subAxis, centAxis}); - histos.add("hVarpi", "hVarpi", kTH2D, {subAxis, centAxis}); - histos.add("hVar2meanptpi", "hVar2meanptpi", kTH2D, {centAxis, varAxis2}); - - histos.add("hVar1k", "hVar1k", kTH2D, {subAxis, centAxis}); - histos.add("hVar2k", "hVar2k", kTH2D, {subAxis, centAxis}); - histos.add("hVark", "hVark", kTH2D, {subAxis, centAxis}); - histos.add("hVar2meanptk", "hVar2meanptk", kTH2D, {centAxis, varAxis2}); - - histos.add("hVar1p", "hVar1p", kTH2D, {subAxis, centAxis}); - histos.add("hVar2p", "hVar2p", kTH2D, {subAxis, centAxis}); - histos.add("hVarp", "hVarp", kTH2D, {subAxis, centAxis}); - histos.add("hVar2meanptp", "hVar2meanptp", kTH2D, {centAxis, varAxis2}); - - //--------------------------------nch---------------------------------- - histos.add("hVar1x", "hVar1x", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x", "hVar2x", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx", "hVarx", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptx", "hVar2meanptx", kTH2D, {nchAxis, varAxis2}); - - histos.add("hVar1pix", "hVar1pix", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2pix", "hVar2pix", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpix", "hVarpix", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpix", "hVar2meanptpix", kTH2D, {nchAxis, varAxis2}); - - histos.add("hVar1kx", "hVar1kx", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2kx", "hVar2kx", kTH2D, {subAxis, nchAxis}); - histos.add("hVarkx", "hVarkx", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptkx", "hVar2meanptkx", kTH2D, {nchAxis, varAxis2}); - - histos.add("hVar1px", "hVar1px", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2px", "hVar2px", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpx", "hVarpx", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpx", "hVar2meanptpx", kTH2D, {nchAxis, varAxis2}); - - histos.add("ht", "ht", kTH1D, {centAxis}); - - histos.add("hCentrality", "hCentrality", kTH1D, {centAxis}); - - histos.add("hPEta", "hPEta", kTH2D, {pAxis, etaAxis}); - histos.add("hPtEta", "hPtEta", kTH2D, {ptAxis, etaAxis}); - histos.add("hPy", "hPy", kTH2D, {pAxis, etaAxis}); - histos.add("hPty", "hPty", kTH2D, {ptAxis, etaAxis}); - - histos.add("hPtyPion", "hPtyPion", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtyKaon", "hPtyKaon", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtyProton", "hPtyProton", kTH2D, {ptAxis, etaAxis}); histos.add("hPtyPion_rec", "hPtyPion_rec", kTH2D, {ptAxis, etaAxis}); histos.add("hPtyKaon_rec", "hPtyKaon_rec", kTH2D, {ptAxis, etaAxis}); @@ -260,14 +331,6 @@ struct IdentifiedMeanPtFluctuations { histos.add("hPyKaon_rec", "hPyKaon_rec", kTH2D, {pAxis, etaAxis}); histos.add("hPyProton_rec", "hPyProton_rec", kTH2D, {pAxis, etaAxis}); - histos.add("hTOFbeta", "hTOFbeta", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx", "hdEdx", kTH2D, {pAxis, dEdxAxis}); - - histos.add("hTOFbeta_afterselection", "hTOFbeta_afterselection", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_afterselection", "hdEdx_afterselection", kTH2D, {pAxis, dEdxAxis}); - - histos.add("hTOFbeta_afterselection1", "hTOFbeta_afterselection1", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_afterselection1", "hdEdx_afterselection1", kTH2D, {pAxis, dEdxAxis}); histos.add("hTOFbeta_afterselection_rec_afterpidcut", "hTOFbeta_afterselection_rec_afterpidcut", kTH2D, {pAxis, betaAxis}); histos.add("hdEdx_afterselection_rec_afterpidcut", "hdEdx_afterselection_rec_afterpidcut", kTH2D, {pAxis, dEdxAxis}); @@ -275,17 +338,21 @@ struct IdentifiedMeanPtFluctuations { histos.add("hTOFbeta_afterselection_rec_beforepidcut", "hTOFbeta_afterselection_rec_beforepidcut", kTH2D, {pAxis, betaAxis}); histos.add("hdEdx_afterselection_rec_beforepidcut", "hdEdx_afterselection_rec_beforepidcut", kTH2D, {pAxis, dEdxAxis}); - histos.add("hdEdx_rec_bf_anycut", "hdEdx_rec_bf_anycut", kTH2D, {pAxis, dEdxAxis}); - - histos.add("hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); - histos.add("hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); - histos.add("hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); - - histos.add("hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); - histos.add("hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); - histos.add("hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); + + histos.add("heffVar1x", "heffVar1x", kTH2D, {subAxis, nchAxis}); + histos.add("heffVar2x", "heffVar2x", kTH2D, {subAxis, nchAxis}); + histos.add("heffVarx", "heffVarx", kTH2D, {subAxis, nchAxis}); + histos.add("heffVar2meanptx", "heffVar2meanptx", kTH2D, {nchAxis, varAxis2}); //--------------------------------nch---------------------------------- + histos.add("hnch_rec_all", ";hnch_rec_all", kTH1D, {nchAxis}); + histos.add("hnch_rec", ";hnch_rec", kTH1D, {nchAxis}); + histos.add("hnch_rec_true", ";hnch_rec_true", kTH1D, {nchAxis}); + + histos.add("hVar1x_rec_old", "hVar1x_rec_old", kTH2D, {subAxis, nchAxis}); + histos.add("hVar2x_rec_old", "hVar2x_rec_old", kTH2D, {subAxis, nchAxis}); + histos.add("hVarx_rec_old", "hVarx_rec_old", kTH2D, {subAxis, nchAxis}); + histos.add("hVar1x_rec", "hVar1x_rec", kTH2D, {subAxis, nchAxis}); histos.add("hVar2x_rec", "hVar2x_rec", kTH2D, {subAxis, nchAxis}); histos.add("hVarx_rec", "hVarx_rec", kTH2D, {subAxis, nchAxis}); @@ -306,6 +373,30 @@ struct IdentifiedMeanPtFluctuations { histos.add("hVarpx_rec", "hVarpx_rec", kTH2D, {subAxis, nchAxis}); histos.add("hVar2meanptpx_rec", "hVar2meanptpx_rec", kTH2D, {nchAxis, varAxis2}); + histos.add("hZvtx_after_sel_rec", "hZvtx_after_sel_rec", kTH1D, {vtxZAxis}); + histos.add("hZvtx_after_sel8_rec", "hZvtx_after_sel8_rec", kTH1D, {vtxZAxis}); + + histos.add("etaHistogram_allcharge_rec", "etaHistogram_allcharge_rec", kTH1D, {etaAxis}); + + histos.add("ptHistogram_allcharge_bfptcut_rec", "ptHistogram_allcharge_bfptcut_rec", kTH1D, {ptAxis}); + + histos.add("ptHistogram_allcharge_rec", "ptHistogram_allcharge_rec", kTH1D, {ptAxis}); + histos.add("ptHistogramPionrec", "ptHistogramPionrec", kTH1D, {ptAxis}); + histos.add("ptHistogramKaonrec", "ptHistogramKaonrec", kTH1D, {ptAxis}); + histos.add("ptHistogramProtonrec", "ptHistogramProtonrec", kTH1D, {ptAxis}); + + histos.add("ptHistogramPionrec_purity", "ptHistogramPionrec_purity", kTH1D, {ptAxis}); + histos.add("ptHistogramKaonrec_purity", "ptHistogramKaonrec_purity", kTH1D, {ptAxis}); + histos.add("ptHistogramProtonrec_purity", "ptHistogramProtonrec_purity", kTH1D, {ptAxis}); + + histos.add("ptHistogramPionrec_pdg", "ptHistogramPionrec_pdg", kTH1D, {ptAxis}); + histos.add("ptHistogramKaonrec_pdg", "ptHistogramKaonrec_pdg", kTH1D, {ptAxis}); + histos.add("ptHistogramProtonrec_pdg", "ptHistogramProtonrec_pdg", kTH1D, {ptAxis}); + + histos.add("Histogram_mass2_p_rec_beforesel", "Histogram_mass2_p_rec_beforesel", kTH1D, {ptAxis}); + histos.add("Histogram_mass2_p_rec_aftersel", "Histogram_mass2_p_rec_aftersel", kTH1D, {ptAxis}); + + //=======================MC histograms Generated ================================================ histos.add("ptHistogram_allcharge_gen", "ptHistogram_allcharge_gen", kTH1D, {ptAxis}); histos.add("ptHistogramPion", "ptHistogramPion", kTH1D, {ptAxis}); @@ -318,6 +409,27 @@ struct IdentifiedMeanPtFluctuations { histos.add("hTOFbeta_gen_pion", "hTOFbeta_gen_pion", kTH2D, {pAxis, betaAxis}); histos.add("hdEdx_gen_pion", "hdEdx_gen_pion", kTH2D, {pAxis, dEdxAxis}); + histos.add("hnch_gen_all", ";hnch_gen_all", kTH1D, {nchAxis}); + histos.add("hnch_gen", ";hnch_gen", kTH1D, {nchAxis}); + histos.add("hnch_gen_true", ";hnch_gen_true", kTH1D, {nchAxis}); + + histos.add("hnch_gen_eta", ";hnch_gen_eta", kTH1D, {etaAxis}); + + + histos.add("hnch1", ";hnch1", kTH1D, {nchAxis}); + histos.add("hnch2", ";hnch2", kTH1D, {nchAxis}); + histos.add("hnch3", ";hnch3", kTH1D, {nchAxis}); + histos.add("hnch_pi", ";hnch_pi", kTH1D, {nchAxis}); + histos.add("hnch_ka", ";hnch_ka", kTH1D, {nchAxis}); + histos.add("hnch_pr", ";hnch_pr", kTH1D, {nchAxis}); + + + + histos.add("hVar1x_gen_old", "hVar1x_gen_old", kTH2D, {subAxis, nchAxis}); + histos.add("hVar2x_gen_old", "hVar2x_gen_old", kTH2D, {subAxis, nchAxis}); + histos.add("hVarx_gen_old", "hVarx_gen_old", kTH2D, {subAxis, nchAxis}); + + histos.add("hVar1x_gen", "hVar1x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVar2x_gen", "hVar2x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVarx_gen", "hVarx_gen", kTH2D, {subAxis, nchAxis}); @@ -340,830 +452,1001 @@ struct IdentifiedMeanPtFluctuations { //========================MC Histograms Reconstructed================================================= - histos.add("hZvtx_after_sel_rec", "hZvtx_after_sel_rec", kTH1D, {vtxZAxis}); - histos.add("hZvtx_after_sel8_rec", "hZvtx_after_sel8_rec", kTH1D, {vtxZAxis}); + + histos.add("hcent_nacc_rec", "hcent_nacc_rec", kTH2D, {centAxis, nchAxis}); + histos.add("hcent_nacc_gen", "hcent_nacc_gen", kTH2D, {centAxis, nchAxis}); + histos.add("hGenCentrality", "hGenCentrality", kTH1D, {centAxis}); + + histos.add("hVtxZ_before_gen", "", kTH1F, {vtxZAxis}); + histos.add("hVtxZ_after_gen", "", kTH1F, {vtxZAxis}); + histos.add("hEta_gen", "", kTH1F, {etaAxis}); + histos.add("hEta_rec", "", kTH1F, {etaAxis}); + histos.add("hPt_gen", "", kTH1F, {ptAxis}); + histos.add("hPt_rec", "", kTH1F, {ptAxis}); - histos.add("ptHistogram_allcharge_rec", "ptHistogram_allcharge_rec", kTH1D, {ptAxis}); - histos.add("ptHistogramPionrec", "ptHistogramPionrec", kTH1D, {ptAxis}); - histos.add("ptHistogramKaonrec", "ptHistogramKaonrec", kTH1D, {ptAxis}); - histos.add("ptHistogramProtonrec", "ptHistogramProtonrec", kTH1D, {ptAxis}); - histos.add("ptHistogramPionrec_purity", "ptHistogramPionrec_purity", kTH1D, {ptAxis}); - histos.add("ptHistogramKaonrec_purity", "ptHistogramKaonrec_purity", kTH1D, {ptAxis}); - histos.add("ptHistogramProtonrec_purity", "ptHistogramProtonrec_purity", kTH1D, {ptAxis}); - histos.add("ptHistogramPionrec_pdg", "ptHistogramPionrec_pdg", kTH1D, {ptAxis}); - histos.add("ptHistogramKaonrec_pdg", "ptHistogramKaonrec_pdg", kTH1D, {ptAxis}); - histos.add("ptHistogramProtonrec_pdg", "ptHistogramProtonrec_pdg", kTH1D, {ptAxis}); - - histos.add("Histogram_mass2_p_rec_beforesel", "Histogram_mass2_p_rec_beforesel", kTH1D, {ptAxis}); - histos.add("Histogram_mass2_p_rec_aftersel", "Histogram_mass2_p_rec_aftersel", kTH1D, {ptAxis}); } - //++++++++++++++++++++++++Monte Carlo Reconstructed +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - template - void SelTPConlyPions(const T& track1) - { - (track1.hasTPC() && (track1.p() < 0.7) && abs(track1.tpcNSigmaPi()) < 3. && (std::abs(track1.tpcNSigmaKa()) > 3.0 && std::abs(track1.tpcNSigmaPr()) > 3.0)); - } - template - void SelTPConlyKaons(const T& track1) - { - (track1.hasTPC() && (track1.p() < 0.7) && abs(track1.tpcNSigmaKa()) < 3.0 && (std::abs(track1.tpcNSigmaPi()) > 3.0 && std::abs(track1.tpcNSigmaPr()) > 3.0)); - } - template - void SelTPConlyProtons(const T& track1) - { - (track1.hasTPC() && (track1.p() < 1.1) && abs(track1.tpcNSigmaPr()) < 3.0 && (std::abs(track1.tpcNSigmaPi()) > 3.0 && std::abs(track1.tpcNSigmaKa()) > 3.0)); - } + + // Configurables + Configurable cVtxZcut{"cVtx", 10.f, "Vertex Z"}; + Configurable cEtacut{"cEta", 0.8, "Eta cut"}; + Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; + Configurable cPtmaxcut{"cPtmaxcut", 2.0, "Pt max cut"}; + Configurable cDcaXYcut{"cDcaXYcut", 0.12, "DCA XY cut"}; + Configurable cDcaZcut{"cDcaZcut", 0.3, "DCA Z cut"}; + Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; + Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; + Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; + Configurable cITSchicut{"cITSchi2clustercut", 70, "ITS chi2 cluster cut"}; + Configurable cTPCchicut{"cTPCchi2clustercut", 70, "TPC chi2 cluster cut"}; + + + // Event selections + Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; + Configurable cTFBorder{"cTFBorder", true, "Timeframe Border Selection"}; + Configurable cNoItsROBorder{"cNoItsROBorder", true, "No ITSRO Border Cut"}; + Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; + Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", true, "z-vtx time diff selection"}; + Configurable cIsGoodITSLayers{"cIsGoodITSLayers", true, "Good ITS Layers All"}; + Configurable cItslayerall{"cItslayerall", true, "dead staves of ITS removed"}; + Configurable cvtxtofmatched{"cvtxtofmatched", true, "TOF vertex matched"}; + Configurable cfgRejEl{"cfgRejEl", true, "Rejected electrons"}; + + + //PID selection configurables + Configurable cPionPmincut{"cPionPmincut", 0.2, "pion min cut of pion"}; + Configurable cKaonPmincut{"cKaonPmincut", 0.2, "kaon min cut of kaon"}; + Configurable cProtonPmincut{"cProtonPmincut", 0.2, "proton min cut of proton"}; + Configurable cPionPmaxcut{"cPionPmaxcut", 2.0, "pion min cut of pion"}; + Configurable cKaonPmaxcut{"cKaonPmaxcut", 2.0, "kaon min cut of kaon"}; + Configurable cProtonPmaxcut{"cProtonPmaxcut", 2.0, "proton min cut of proton"}; + Configurable cPionPthcut{"cPionPthcut", 0.65, "pion threshold cut of pion"}; + Configurable cKaonPthcut{"cKaonPthcut", 0.65, "kaon threshold cut of kaon"}; + Configurable cProtonPthcut{"cProtonPthcut", 1.0, "proton threshold cut of proton"}; + Configurable cNSigCut2{"cNSigCut2", 2.0, "nSigma cut (2)"}; + Configurable cNSigCut3{"cNSigCut3", 3.0, "nSigma cut (3)"}; + + + template < typename C> + bool selCollision(C const& coll) + { + + if (std::abs(coll.posZ()) > cVtxZcut) {return false;} //Reject the collisions with large vertex-z + histos.fill(HIST("hEventCounter"), 2.); - template - void SelTPCTOFPions(const T& track1) - { - (track1.hasTPC() && track1.hasTOF() && track1.p() >= 0.7 && TMath::Hypot((track1.tofNSigmaPr() + 2) / 3.0, (track1.tpcNSigmaPr() - 6) / 4.0) > 3. && TMath::Hypot((track1.tofNSigmaKa() + 2) / 3.0, (track1.tpcNSigmaKa() - 6) / 4.0) > 3. && TMath::Hypot((track1.tofNSigmaPi() + 2) / 3.0, (track1.tpcNSigmaPi() - 6) / 4.0) < 3.); - } +// cent = coll.centFT0M(); //centrality for run3 + if (cSel8Trig && !coll.sel8()) {return false;} //require min bias trigger + histos.fill(HIST("hEventCounter"), 3.); + + if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) {return false;} + if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) {return false;} + histos.fill(HIST("tracksel_rec"), 4); + + if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) {return false;} + histos.fill(HIST("tracksel_rec"), 5); - template - void SelTPCTOFKaons(const T& track1) - { - (track1.hasTPC() && track1.hasTOF() && track1.p() >= 0.7 && TMath::Hypot((track1.tofNSigmaPr() + 2) / 3.0, (track1.tpcNSigmaPr() - 6) / 4.0) > 3. && TMath::Hypot((track1.tofNSigmaPi() + 2) / 3.0, (track1.tpcNSigmaPi() - 6) / 4.0) > 3. && TMath::Hypot((track1.tofNSigmaKa() + 2) / 3.0, (track1.tpcNSigmaKa() - 6) / 4.0) < 3.); - } + if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) {return false;} + histos.fill(HIST("tracksel_rec"), 6); - template - void SelTPCTOFProtons(const T& track1) - { - if (track1.hasTPC() && track1.hasTOF() && track1.p() >= 1.1 && TMath::Hypot((track1.tofNSigmaPi() + 2) / 3.0, (track1.tpcNSigmaPi() - 6) / 4.0) > 3. && TMath::Hypot((track1.tofNSigmaKa() + 2) / 3.0, (track1.tpcNSigmaKa() - 6) / 4.0) > 3. && TMath::Hypot((track1.tofNSigmaPr() + 2) / 3.0, (track1.tpcNSigmaPr() - 6) / 4.0) < 3.) { - }; - } + if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) {return false;} + histos.fill(HIST("tracksel_rec"), 7); - void processMCReco(aod::MyMCRecoCollisions::iterator const& mccoll, aod::MyMCRecoTracks const& mcrectrack, aod::McParticles const& /*mcParticles*/) - { - if (!mccoll.has_mcCollision()) { - return; - } - histos.fill(HIST("tracksel_rec"), 1); +// if (cItslayerall && !coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)) {return false;} + histos.fill(HIST("tracksel_rec"), 8); - if (fabs(mccoll.posZ()) > 10.f) { - return; - } - histos.fill(HIST("hZvtx_after_sel_rec"), mccoll.posZ()); + if (cvtxtofmatched && !coll.selection_bit(aod::evsel::kIsVertexTOFmatched)) {return false;} + histos.fill(HIST("tracksel_rec"), 9); - histos.fill(HIST("tracksel_rec"), 2); - if (!mccoll.sel8()) { - return; - } - - histos.fill(HIST("hZvtx_after_sel8_rec"), mccoll.posZ()); + return true; //if all checks pass, accept the collision - histos.fill(HIST("tracksel_rec"), 3); - - if (!mccoll.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return; } - histos.fill(HIST("tracksel_rec"), 4); - if (!mccoll.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - return; - } - histos.fill(HIST("tracksel_rec"), 5); - if (!mccoll.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; - } - histos.fill(HIST("tracksel_rec"), 6); - if (!mccoll.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return; - } - histos.fill(HIST("tracksel_rec"), 7); + template + bool selTrack(T const& track) + { + + if (!track.isGlobalTrack()) {return false;} //accept only global tracks + histos.fill(HIST("tracksel"), 2); - double nCh_rec = 0.; - double nChpi_rec = 0.; - double nChk_rec = 0.; - double nChp_rec = 0.; +// if (std::fabs(track.dcaXY()) > cDcaXYcut) {return false;} + histos.fill(HIST("tracksel"), 3); - double Q1_rec = 0, Q2_rec = 0; - double Q1pi_rec = 0, Q2pi_rec = 0; - double Q1k_rec = 0, Q2k_rec = 0; - double Q1p_rec = 0, Q2p_rec = 0; - double var1_rec = 0, var2_rec = 0; - double var1pi_rec = 0, var2pi_rec = 0; - double var1k_rec = 0, var2k_rec = 0; - double var1p_rec = 0, var2p_rec = 0; +// if (std::fabs(track.dcaZ()) > cDcaZcut) {return false;} + histos.fill(HIST("tracksel"), 4); - int sample_rec = histos.get(HIST("hZvtx_after_sel8_rec"))->GetEntries(); - sample_rec = sample_rec % 30; + if (std::fabs(track.eta()) >= cEtacut) {return false;} + histos.fill(HIST("tracksel"), 5); - for (auto track1 : mcrectrack) { - if (!(track1.has_collision())) - continue; - if (!(track1.has_mcParticle())) - continue; - if (!(track1.mcParticle().isPhysicalPrimary())) - continue; - if (!track1.isGlobalTrack()) - continue; + if (track.pt() < cPtmincut ) {return false;} + if (track.pt() > cPtmaxcut) {return false;} + histos.fill(HIST("tracksel"), 6); - if (!(track1.pt() > 0.15) || !(track1.pt() < 2.0)) - continue; // pt = 0.15 - if (!(track1.eta() > -0.8) || !(track1.eta() < 0.8)) - continue; // eta cut +// if (track.tpcNClsCrossedRows() < cTPCcrosscut) {return false;} + histos.fill(HIST("tracksel"), 7); - nCh_rec += 1.; +// if (track.itsChi2NCl() > cITSchicut) {return false;} + histos.fill(HIST("tracksel"), 8); - Q1_rec += track1.pt(); - Q2_rec += (track1.pt() * track1.pt()); +// if (track.tpcChi2NCl() > cTPCchicut) {return false;} + histos.fill(HIST("tracksel"), 9); - histos.fill(HIST("ptHistogram_allcharge_rec"), track1.pt()); + if (track.sign() == 0) return false; - if (track1.hasTPC()) - histos.fill(HIST("hdEdx_rec_bf_anycut"), track1.p(), track1.tpcSignal()); + return true; //if all checks pass, accept the collision + } - //======================================================================== - if (abs(track1.mcParticle().pdgCode()) == 211) { + template + bool rej_El(T const& track) + { + if ( track.tpcNSigmaEl() > -3. && track.tpcNSigmaEl() < 5. && std::fabs(track.tpcNSigmaPi()) > cNSigCut3 && std::fabs(track.tpcNSigmaKa()) > cNSigCut3 && std::fabs(track.tpcNSigmaPr()) > cNSigCut3) { return true; } + return false; + } - histos.fill(HIST("ptHistogramPionrec_pdg"), track1.pt()); - } - if (abs(track1.mcParticle().pdgCode()) == 321) { - histos.fill(HIST("ptHistogramKaonrec_pdg"), track1.pt()); - } - if (abs(track1.mcParticle().pdgCode()) == 2212) { - histos.fill(HIST("ptHistogramProtonrec_pdg"), track1.pt()); - } - //+++++++++ electron rejection ++++++++++++++++++++++++++++++++// + template + bool sel_proton(T const& track) + { - if (abs(track1.tpcNSigmaEl()) < 3.0 && abs(track1.tpcNSigmaPi()) > 3. && abs(track1.tpcNSigmaKa()) > 3. && abs(track1.tpcNSigmaPr()) > 3.) - continue; + //! if pt < threshold (For tracks without TOF information) + if (track.p() > cProtonPmincut && track.p() <= cProtonPthcut) { + if (track.hasTPC() && std::fabs(track.tpcNSigmaPr()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2) { return true; } + } - //============Reconstructed MC=================PIONS selection==============================================================// + //! if pt < threshold (For tracks with TOF information) + if (track.p() > cProtonPmincut && track.p() <= cProtonPthcut) { + if (track.hasTOF() && std::fabs(track.tpcNSigmaPr()) < cNSigCut2 && std::fabs(track.tofNSigmaPr()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2) { return true; } + } - if (track1.hasTPC()) - histos.fill(HIST("hdEdx_afterselection_rec_beforepidcut"), track1.p(), track1.tpcSignal()); - if (track1.hasTOF()) - histos.fill(HIST("hTOFbeta_afterselection_rec_beforepidcut"), track1.p(), track1.beta()); - if (track1.hasTPC() && track1.hasTOF()) { + //! if pt > threshold (For tracks with TOF information) + if (track.p() > cProtonPthcut && track.p() <= cProtonPmaxcut) { + if ( track.hasTPC() && track.hasTOF() && std::fabs(track.tpcNSigmaPr()) < cNSigCut2 && std::fabs(track.tofNSigmaPr()) < cNSigCut2 && std::hypot(track.tofNSigmaPi(), track.tpcNSigmaPi()) > cNSigCut2 && std::hypot(track.tofNSigmaKa(), track.tpcNSigmaKa()) > cNSigCut2 ) { return true; } + } - histos.fill(HIST("NSigamaTPCpion_rec_bf_sel"), track1.p(), track1.tpcNSigmaPi()); - histos.fill(HIST("NSigamaTOFpion_rec_bf_sel"), track1.p(), track1.tofNSigmaPi()); - histos.fill(HIST("NSigamaTPCTOFpion_rec_bf_sel"), track1.tpcNSigmaPi(), track1.tofNSigmaPi()); - } + return false; - SelTPConlyPions(track1); // Pion (TPC only) - SelTPCTOFPions(track1); // Pion passes TPC and TOF both! + } - { + template + bool sel_kaon(T const& track) + { - histos.fill(HIST("ptHistogramPionrec"), track1.pt()); + //! if pt < threshold (For tracks without TOF information) + if (track.p() > cKaonPmincut && track.p() <= cKaonPthcut) { + if (track.hasTPC() && std::fabs(track.tpcNSigmaKa()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } + } - nChpi_rec += 1.; - Q1pi_rec += track1.pt(); - Q2pi_rec += (track1.pt() * track1.pt()); + //! if pt < threshold (For tracks with TOF information) + if (track.p() > cKaonPmincut && track.p() <= cKaonPthcut) { + if (track.hasTOF() && std::fabs(track.tpcNSigmaKa()) < cNSigCut2 && std::fabs(track.tofNSigmaKa()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } + } - histos.fill(HIST("NSigamaTPCpion_rec"), track1.p(), track1.tpcNSigmaPi()); - histos.fill(HIST("NSigamaTOFpion_rec"), track1.p(), track1.tofNSigmaPi()); - histos.fill(HIST("NSigamaTPCTOFpion_rec"), track1.tpcNSigmaPi(), track1.tofNSigmaPi()); - if (track1.beta() > 1) - continue; + //! if pt > threshold (For tracks with TOF information) + if (track.p() > cKaonPthcut && track.p() <= cKaonPmaxcut) { + if ( track.hasTPC() && track.hasTOF() && std::fabs(track.tpcNSigmaKa()) < cNSigCut2 && std::fabs(track.tofNSigmaKa()) < cNSigCut2 && std::hypot(track.tofNSigmaPi(), track.tpcNSigmaPi()) > cNSigCut2 && std::hypot(track.tofNSigmaPr(), track.tpcNSigmaPr()) > cNSigCut2 ) { return true; } + } - histos.fill(HIST("hdEdx_afterselection_rec_afterpidcut"), track1.p(), track1.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection_rec_afterpidcut"), track1.p(), track1.beta()); + return false; - if (abs(track1.mcParticle().pdgCode()) == 211) { - histos.fill(HIST("ptHistogramPionrec_purity"), track1.pt()); - } + } - if (abs(track1.rapidity(massPi)) < 0.5) { + template + bool sel_pion(T const& track) + { - histos.fill(HIST("hPyPion_rec"), track1.p(), track1.rapidity(massPi)); - histos.fill(HIST("hPtyPion_rec"), track1.pt(), track1.rapidity(massPi)); - } - } + //! if pt < threshold (For tracks without TOF information) + if (track.p() > cPionPmincut && track.p() <= cPionPthcut) { + if (track.hasTPC() && std::fabs(track.tpcNSigmaPi()) < cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } + } - //============Reconstructed MC=================KAONS selection==============================================================// + //! if pt < threshold (For tracks with TOF information) + if (track.p() > cPionPmincut && track.p() <= cPionPthcut) { + if (track.hasTOF() && std::fabs(track.tpcNSigmaPi()) < cNSigCut2 && std::fabs(track.tofNSigmaPi()) < cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } + } - if (track1.hasTPC()) - histos.fill(HIST("hdEdx_afterselection_rec_beforepidcut"), track1.p(), track1.tpcSignal()); - if (track1.hasTOF()) - histos.fill(HIST("hTOFbeta_afterselection_rec_beforepidcut"), track1.p(), track1.beta()); + //! if pt > threshold (For tracks with TOF information) + if (track.p() > cPionPthcut && track.p() <= cPionPmaxcut) { + if ( track.hasTPC() && track.hasTOF() && std::fabs(track.tpcNSigmaPi()) < cNSigCut2 && std::fabs(track.tofNSigmaPi()) < cNSigCut2 && std::hypot(track.tofNSigmaKa(), track.tpcNSigmaKa()) > cNSigCut2 && std::hypot(track.tofNSigmaPr(), track.tpcNSigmaPr()) > cNSigCut2 ) { return true; } + } - if (track1.hasTPC() && track1.hasTOF()) { + return false; - histos.fill(HIST("NSigamaTPCkaon_rec_bf_sel"), track1.p(), track1.tpcNSigmaKa()); - histos.fill(HIST("NSigamaTOFkaon_rec_bf_sel"), track1.p(), track1.tofNSigmaKa()); - histos.fill(HIST("NSigamaTPCTOFkaon_rec_bf_sel"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); - } + } - SelTPConlyKaons(track1); // Kaons passes from TPC only! - SelTPCTOFKaons(track1); // Kaons passes from TPC and TOF both! - { + //++++++++++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++// + // // + // // + // // + //++++++++++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++// - histos.fill(HIST("ptHistogramKaonrec"), track1.pt()); + void process(aod::MyCollision const& coll, aod::MyTracks const& inputTracks) + { + histos.fill(HIST("hEventCounter"), 1.); + histos.fill(HIST("Data/hZvtx_before_sel"), coll.posZ()); - nChk_rec += 1.; - Q1k_rec += track1.pt(); - Q2k_rec += (track1.pt() * track1.pt()); + if (!selCollision(coll)) return; + { histos.fill(HIST("Data/hZvtx_after_sel8"), coll.posZ()); + } + + const auto cent = coll.centFT0C(); + histos.fill(HIST("Data/hCentrality"), cent); + - histos.fill(HIST("NSigamaTPCkaon_rec"), track1.p(), track1.tpcNSigmaKa()); - histos.fill(HIST("NSigamaTOFkaon_rec"), track1.p(), track1.tofNSigmaKa()); - histos.fill(HIST("NSigamaTPCTOFkaon_rec"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); + double nCh = 0., nChpi = 0., nChk = 0., nChp = 0., nCh_all = 0., nCh_true = 0., nCh_all_bfcut = 0., nCh_eta = 0., nCh_pt = 0.; + double Q1 = 0., Q2 = 0., Q1_old = 0., Q2_old = 0.; + double Q1pi = 0., Q2pi = 0.; + double Q1k = 0., Q2k = 0.; + double Q1p = 0., Q2p = 0.; + double var1 = 0., var2 = 0., twopar_allcharge = 0., var1_old = 0., var2_old = 0.; + double var1pi = 0., var2pi = 0.; + double var1k = 0., var2k = 0.; + double var1p = 0., var2p = 0.; + // double sum_pt_weight = 0., sum_weight = 0., sum_pt_pt_weight = 0.; - if (track1.beta() > 1) - continue; + int sample = histos.get(HIST("Data/hZvtx_after_sel8"))->GetEntries(); + sample = sample % 30; //subsample error estimation - histos.fill(HIST("hdEdx_afterselection_rec_afterpidcut"), track1.p(), track1.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection_rec_afterpidcut"), track1.p(), track1.beta()); + // Perfroming the track selection========================================== + for (auto track : inputTracks) { - if (abs(track1.mcParticle().pdgCode()) == 321) { - histos.fill(HIST("ptHistogramKaonrec_purity"), track1.pt()); - } + nCh_all_bfcut += 1.; + histos.fill(HIST("Data/hnch_all_bf_cut"), nCh_all_bfcut); + + histos.fill(HIST("tracksel"), 1); + histos.fill(HIST("Data/hTPCchi2perCluster_before"), track.tpcChi2NCl()); + histos.fill(HIST("Data/hITSchi2perCluster_before"), track.itsChi2NCl()); + histos.fill(HIST("Data/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); + + + if (std::fabs(track.eta()) <= cEtacut ) + {nCh_eta++; + histos.fill(HIST("Data/hnch_true"), nCh_eta); + } + + if (track.pt() >= cPtmincut && track.pt() <= cPtmaxcut){ + nCh_pt += 1.; + histos.fill(HIST("Data/hnch_true_pt"), nCh_pt);} + + + if(track.sign() == 0) continue; + if (!selTrack(track)) continue; + + nCh_all += 1.; + histos.fill(HIST("Data/hnch_all"), nCh_all); + + + histos.fill(HIST("Data/hDCAxy"), track.dcaXY()); + histos.fill(HIST("Data/hDCAz"), track.dcaZ()); + histos.fill(HIST("Data/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); + histos.fill(HIST("Data/hTPCchi2perCluster_after"), track.tpcChi2NCl()); + histos.fill(HIST("Data/hITSchi2perCluster_after"), track.itsChi2NCl()); + histos.fill(HIST("Data/hP"), track.p()); + histos.fill(HIST("Data/hPt"), track.pt()); + histos.fill(HIST("Data/hEta"), track.eta()); + histos.fill(HIST("Data/hPtDCAxy"), track.pt(), track.dcaXY()); + histos.fill(HIST("Data/hPtDCAz"), track.pt(), track.dcaZ()); + histos.fill(HIST("Data/hPtEta"), track.pt(), track.eta()); + histos.fill(HIST("Data/hPEta"), track.p(), track.eta()); + histos.fill(HIST("Data/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); + + + if (track.pt() >= 0.15 || track.pt() <= 2.0) //do not change this (it is for different pt work) + {nCh += 1.; + Q1_old += track.pt(); + Q2_old += (track.pt() * track.pt()); + histos.fill(HIST("Data/hnch"), nCh); + + } + // histos.fill(HIST("hnch"), nCh); + + Q1 += track.pt(); + Q2 += (track.pt() * track.pt()); - if (abs(track1.rapidity(massKa)) < 0.5) { - histos.fill(HIST("hPyKaon_rec"), track1.p(), track1.rapidity(massKa)); - histos.fill(HIST("hPtyKaon_rec"), track1.pt(), track1.rapidity(massKa)); - } - } + + // only TPC tracks: Pion, Kaon, Proton + if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < 3.) + histos.fill(HIST("Data/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); + if (track.hasTPC() && std::abs(track.tpcNSigmaKa()) < 3.) + histos.fill(HIST("Data/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); + if (track.hasTPC() && std::abs(track.tpcNSigmaPr()) < 3.) + histos.fill(HIST("Data/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); - //============Reconstructed MC=================PROTONS selection==============================================================// + // only TOF tracks: Pion, Kaon, Proton + if (track.hasTOF() && std::abs(track.tofNSigmaPi()) < 3.) + histos.fill(HIST("Data/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); + if (track.hasTOF() && std::abs(track.tofNSigmaKa()) < 3.) + histos.fill(HIST("Data/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); + if (track.hasTOF() && std::abs(track.tofNSigmaPr()) < 3.) + histos.fill(HIST("Data/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); - if (track1.hasTPC()) - histos.fill(HIST("hdEdx_afterselection_rec_beforepidcut"), track1.p(), track1.tpcSignal()); - if (track1.hasTOF()) - histos.fill(HIST("hTOFbeta_afterselection_rec_beforepidcut"), track1.p(), track1.beta()); + if (track.hasTPC()) histos.fill(HIST("Data/hdEdx"), track.p(), track.tpcSignal()); + if (track.hasTOF()) histos.fill(HIST("Data/hTOFbeta"), track.p(), track.beta()); - if (track1.hasTPC() && track1.hasTOF()) { + //===================================pion============================================================== + // only TPC+TOF tracks: Pion, Kaon, Proton + if ((track.hasTPC() && std::abs(track.tpcNSigmaPi()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaPi()) < 3.)) { + histos.fill(HIST("Data/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - histos.fill(HIST("NSigamaTPCproton_rec_bf_sel"), track1.p(), track1.tpcNSigmaPr()); - histos.fill(HIST("NSigamaTOFproton_rec_bf_sel"), track1.p(), track1.tofNSigmaPr()); - histos.fill(HIST("NSigamaTPCTOFproton_rec_bf_sel"), track1.tpcNSigmaPr(), track1.tofNSigmaPr()); + histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } - SelTPConlyProtons(track1); // Protons passes from TPC only! - SelTPCTOFProtons(track1); // Protons passes from TPC and TOF both! - - { - - histos.fill(HIST("ptHistogramProtonrec"), track1.pt()); - - nChp_rec += 1.; - Q1p_rec += track1.pt(); - Q2p_rec += (track1.pt() * track1.pt()); + + if(sel_pion(track)){ + histos.fill(HIST("Data/hPtPion"), track.pt()); + histos.fill(HIST("Data/hEtaPion"), track.eta()); + histos.fill(HIST("Data/hyPion"), track.rapidity(massPi)); + histos.fill(HIST("Data/hPtyPion"), track.pt(), track.rapidity(massPi)); - histos.fill(HIST("NSigamaTPCproton_rec"), track1.p(), track1.tpcNSigmaPr()); - histos.fill(HIST("NSigamaTOFproton_rec"), track1.p(), track1.tofNSigmaPr()); - histos.fill(HIST("NSigamaTPCTOFproton_rec"), track1.tpcNSigmaPr(), track1.tofNSigmaPr()); - - if (track1.beta() > 1) - continue; + nChpi += 1.; + Q1pi += track.pt(); + Q2pi += (track.pt() * track.pt()); - histos.fill(HIST("hdEdx_afterselection_rec_afterpidcut"), track1.p(), track1.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection_rec_afterpidcut"), track1.p(), track1.beta()); + if (track.beta() > 1) continue; - if (abs(track1.mcParticle().pdgCode()) == 2212) { - histos.fill(HIST("ptHistogramProtonrec_purity"), track1.pt()); - } + histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); + } - if (abs(track1.rapidity(massPr)) < 0.5) { + + //===========================kaon=============================================================== - histos.fill(HIST("hPyProton_rec"), track1.p(), track1.rapidity(massPr)); - histos.fill(HIST("hPtyProton_rec"), track1.pt(), track1.rapidity(massPr)); - } + if ((track.hasTPC() && std::abs(track.tpcNSigmaKa()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaKa()) < 3.)) { + histos.fill(HIST("Data/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } - //============================================================================ + if(sel_kaon(track)){ - } // track loop ends - if (nCh_rec < 2) - return; + histos.fill(HIST("Data/hPtKaon"), track.pt()); + histos.fill(HIST("Data/hEtaKaon"), track.eta()); + histos.fill(HIST("Data/hyKaon"), track.rapidity(massKa)); + histos.fill(HIST("Data/hPtyKaon"), track.pt(), track.rapidity(massKa)); - //------------------ all charges------------------------------------- - var1_rec = (Q1_rec * Q1_rec - Q2_rec) / (nCh_rec * (nCh_rec - 1)); - var2_rec = (Q1_rec / nCh_rec); - - //---------------------- pions ---------------------------------------- + nChk += 1.; + Q1k += track.pt(); + Q2k += (track.pt() * track.pt()); - if (nChpi_rec > 2) { - var1pi_rec = (Q1pi_rec * Q1pi_rec - Q2pi_rec) / (nChpi_rec * (nChpi_rec - 1)); - var2pi_rec = (Q1pi_rec / nChpi_rec); - } + if (track.beta() > 1) + continue; - //----------------------- kaons --------------------------------------- - if (nChk_rec > 2) { - var1k_rec = (Q1k_rec * Q1k_rec - Q2k_rec) / (nChk_rec * (nChk_rec - 1)); - var2k_rec = (Q1k_rec / nChk_rec); - } + histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); + } - //---------------------------- protons ---------------------------------- - if (nChp_rec > 2) { - var1p_rec = (Q1p_rec * Q1p_rec - Q2p_rec) / (nChp_rec * (nChp_rec - 1)); - var2p_rec = (Q1p_rec / nChp_rec); - } - //-----------------------nch------------------------------------- - histos.fill(HIST("hVar1x_rec"), sample_rec, nCh_rec, var1_rec); - histos.fill(HIST("hVar2x_rec"), sample_rec, nCh_rec, var2_rec); - histos.fill(HIST("hVarx_rec"), sample_rec, nCh_rec); - histos.fill(HIST("hVar2meanptx_rec"), nCh_rec, var2_rec); + //============================proton=========================================================== - histos.fill(HIST("hVar1pix_rec"), sample_rec, nCh_rec, var1pi_rec); - histos.fill(HIST("hVar2pix_rec"), sample_rec, nCh_rec, var2pi_rec); - histos.fill(HIST("hVarpix_rec"), sample_rec, nChpi_rec); - histos.fill(HIST("hVar2meanptpix_rec"), nCh_rec, var2pi_rec); + if ((track.hasTPC() && std::abs(track.tpcNSigmaPr()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaPr()) < 3.)) { + histos.fill(HIST("Data/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - histos.fill(HIST("hVar1kx_rec"), sample_rec, nCh_rec, var1k_rec); - histos.fill(HIST("hVar2kx_rec"), sample_rec, nCh_rec, var2k_rec); - histos.fill(HIST("hVarkx_rec"), sample_rec, nChk_rec); - histos.fill(HIST("hVar2meanptkx_rec"), nCh_rec, var2k_rec); + histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); + } - histos.fill(HIST("hVar1px_rec"), sample_rec, nCh_rec, var1p_rec); - histos.fill(HIST("hVar2px_rec"), sample_rec, nCh_rec, var2p_rec); - histos.fill(HIST("hVarpx_rec"), sample_rec, nChp_rec); - histos.fill(HIST("hVar2meanptpx_rec"), nCh_rec, var2p_rec); + if(sel_proton(track)){ + histos.fill(HIST("Data/hPtProton"), track.pt()); + histos.fill(HIST("Data/hEtaProton"), track.eta()); + histos.fill(HIST("Data/hyProton"), track.rapidity(massPr)); + histos.fill(HIST("Data/hPtyProton"), track.pt(), track.rapidity(massPr)); - } // ends + nChp += 1.; + Q1p += track.pt(); + Q2p += (track.pt() * track.pt()); - PROCESS_SWITCH(IdentifiedMeanPtFluctuations, processMCReco, "process reconstructed information", true); + if (track.beta() > 1) + continue; - //++++++++++++++++++++++++++++Monte Carlo Generated ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - void processMCGen(aod::McCollision const& mcCollision, aod::McParticles& mcParticles) + histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); + } - { - if (fabs(mcCollision.posZ()) > 10.f) { - return; } - histos.fill(HIST("MC_hZvtx_after_sel"), mcCollision.posZ()); - - double nCh_gen = 0.; - double nChpi_gen = 0.; - double nChk_gen = 0.; - double nChp_gen = 0.; - - double Q1_gen = 0, Q2_gen = 0; - double Q1pi_gen = 0, Q2pi_gen = 0; - double Q1k_gen = 0, Q2k_gen = 0; - double Q1p_gen = 0, Q2p_gen = 0; + // Track loop ends! + + histos.fill(HIST("Data/hcent_nacc"), cent, nCh_all); - double var1_gen = 0, var2_gen = 0; - double var1pi_gen = 0, var2pi_gen = 0; - double var1k_gen = 0, var2k_gen = 0; - double var1p_gen = 0, var2p_gen = 0; + + if (nCh >= 2.0) + { + var1_old = (Q1_old * Q1_old - Q2_old) / (nCh * (nCh - 1)); + var2_old = (Q1_old / nCh); + } - int sample_gen = histos.get(HIST("hZvtx_after_sel"))->GetEntries(); - sample_gen = sample_gen % 30; - for (auto& mcgentrack : mcParticles) - { - auto pdgcode = std::abs(mcgentrack.pdgCode()); - if (!(mcgentrack.has_mcCollision())) - continue; - if (!(mcgentrack.isPhysicalPrimary())) - continue; - if (!(mcgentrack.pt() > 0.15) || !(mcgentrack.pt() < 2.)) - continue; - if (!(mcgentrack.eta() > -0.8) || !(mcgentrack.eta() < 0.8)) - continue; + if (nCh_all < 2.0) return; + var1 = (Q1 * Q1 - Q2) / (nCh_all * (nCh_all - 1)); + var2 = (Q1 / nCh_all); - nCh_gen += 1.; - Q1_gen += mcgentrack.pt(); - Q2_gen += (mcgentrack.pt() * mcgentrack.pt()); + //------------------ all charges------------------------------------- + + histos.fill(HIST("Data/hVar1"), sample, cent, var1); + histos.fill(HIST("Data/hVar2"), sample, cent, var2); + histos.fill(HIST("Data/hVarc"), sample, cent); + histos.fill(HIST("Data/hVar2meanpt"), cent, var2); - histos.fill(HIST("ptHistogram_allcharge_gen"), mcgentrack.pt()); + twopar_allcharge = (var1 - var2); + histos.fill(HIST("Data/hVar"), nCh_all, twopar_allcharge); - if (pdgcode == 211) { + //---------------------- pions ---------------------------------------- - histos.fill(HIST("ptHistogramPion"), mcgentrack.pt()); + if (nChpi >= 2.0) { + var1pi = (Q1pi * Q1pi - Q2pi) / (nChpi * (nChpi - 1)); + var2pi = (Q1pi / nChpi); + } - nChpi_gen += 1.; - Q1pi_gen += mcgentrack.pt(); - Q2pi_gen += (mcgentrack.pt() * mcgentrack.pt()); + //----------------------- kaons --------------------------------------- + if (nChk >= 2.0) { + var1k = (Q1k * Q1k - Q2k) / (nChk * (nChk - 1)); + var2k = (Q1k / nChk); } - if (pdgcode == 321) { + //---------------------------- protons ---------------------------------- + if (nChp >= 2.0) { + var1p = (Q1p * Q1p - Q2p) / (nChp * (nChp - 1)); + var2p = (Q1p / nChp); + } - histos.fill(HIST("ptHistogramKaon"), mcgentrack.pt()); + //========================centrality========================================== - nChk_gen += 1.; - Q1k_gen += mcgentrack.pt(); - Q2k_gen += (mcgentrack.pt() * mcgentrack.pt()); - } + histos.fill(HIST("Data/hVar1pi"), sample, cent, var1pi); + histos.fill(HIST("Data/hVar2pi"), sample, cent, var2pi); + histos.fill(HIST("Data/hVar2meanptpi"), cent, var2pi); - if (pdgcode == 2212) { + histos.fill(HIST("Data/hVar1k"), sample, cent, var1k); + histos.fill(HIST("Data/hVar2k"), sample, cent, var2k); + histos.fill(HIST("Data/hVar2meanptk"), cent, var2k); - histos.fill(HIST("ptHistogramProton"), mcgentrack.pt()); + histos.fill(HIST("Data/hVar1p"), sample, cent, var1p); + histos.fill(HIST("Data/hVar2p"), sample, cent, var2p); + histos.fill(HIST("Data/hVar2meanptp"), cent, var2p); - nChp_gen += 1.; - Q1p_gen += mcgentrack.pt(); - Q2p_gen += (mcgentrack.pt() * mcgentrack.pt()); - } + //-----------------------nch------------------------------------- - //================================= Pion Generated Calculation ==================================== - } // track loop ends! + histos.fill(HIST("Data/hVar1x_old"), sample, nCh_all, var1_old); + histos.fill(HIST("Data/hVar2x_old"), sample, nCh_all, var2_old); + histos.fill(HIST("Data/hVarx_old"), sample, nCh_all); - if (nCh_gen < 2) - return; + histos.fill(HIST("Data/hVar1x"), sample, nCh_all, var1); + histos.fill(HIST("Data/hVar2x"), sample, nCh_all, var2); + histos.fill(HIST("Data/hVarx"), sample, nCh_all); + histos.fill(HIST("Data/hVar2meanptx"), nCh_all, var2); - //------------------ all charges------------------------------------- - var1_gen = (Q1_gen * Q1_gen - Q2_gen) / (nCh_gen * (nCh_gen - 1)); - var2_gen = (Q1_gen / nCh_gen); + histos.fill(HIST("Data/hVar1pix"), sample, nCh_all, var1pi); + histos.fill(HIST("Data/hVar2pix"), sample, nCh_all, var2pi); + histos.fill(HIST("Data/hVarpix"), sample, nChpi); + histos.fill(HIST("Data/hVar2meanptpix"), nCh_all, var2pi); - //---------------------- pions ---------------------------------------- + histos.fill(HIST("Data/hVar1kx"), sample, nCh_all, var1k); + histos.fill(HIST("Data/hVar2kx"), sample, nCh_all, var2k); + histos.fill(HIST("Data/hVarkx"), sample, nChk); + histos.fill(HIST("Data/hVar2meanptkx"), nCh_all, var2k); - if (nChpi_gen > 2) { - var1pi_gen = (Q1pi_gen * Q1pi_gen - Q2pi_gen) / (nChpi_gen * (nChpi_gen - 1)); - var2pi_gen = (Q1pi_gen / nChpi_gen); - } + histos.fill(HIST("Data/hVar1px"), sample, nCh_all, var1p); + histos.fill(HIST("Data/hVar2px"), sample, nCh_all, var2p); + histos.fill(HIST("Data/hVarpx"), sample, nChp); + histos.fill(HIST("Data/hVar2meanptpx"), nCh_all, var2p); - //----------------------- kaons --------------------------------------- - if (nChk_gen > 2) { - var1k_gen = (Q1k_gen * Q1k_gen - Q2k_gen) / (nChk_gen * (nChk_gen - 1)); - var2k_gen = (Q1k_gen / nChk_gen); - } - //---------------------------- protons ---------------------------------- - if (nChp_gen > 2) { - var1p_gen = (Q1p_gen * Q1p_gen - Q2p_gen) / (nChp_gen * (nChp_gen - 1)); - var2p_gen = (Q1p_gen / nChp_gen); - } - //-----------------------nch------------------------------------- - histos.fill(HIST("hVar1x_gen"), sample_gen, nCh_gen, var1_gen); - histos.fill(HIST("hVar2x_gen"), sample_gen, nCh_gen, var2_gen); - histos.fill(HIST("hVarx_gen"), sample_gen, nCh_gen); - histos.fill(HIST("hVar2meanptx_gen"), nCh_gen, var2_gen); + } // event loop ends! - histos.fill(HIST("hVar1pix_gen"), sample_gen, nCh_gen, var1pi_gen); - histos.fill(HIST("hVar2pix_gen"), sample_gen, nCh_gen, var2pi_gen); - histos.fill(HIST("hVarpix_gen"), sample_gen, nChpi_gen); - histos.fill(HIST("hVar2meanptpix_gen"), nCh_gen, var2pi_gen); + PROCESS_SWITCH(IdentifiedMeanPtFluctuations, process, "process real data information", false); + + //++++++++++++++++++++++++++++++++++++MC Reconstructed +++++++++++++++++++++++++++++++++++++++++++++++++++++// + // // + // // + // // + //++++++++++++++++++++++++++++++++++++MC Reconstructed +++++++++++++++++++++++++++++++++++++++++++++++++++++// + +SliceCache cache; +Preslice mcTrack = o2::aod::mcparticle::mcCollisionId; + + void processMcReco (aod::MyMCRecoCollision const& coll, aod::MyMCRecoTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + { + + if (!coll.has_mcCollision()) { return; } + + histos.fill(HIST("Rec/hZvtx_before_sel"), coll.posZ()); + histos.fill(HIST("hVtxZ_before_gen"), coll.mcCollision().posZ()); + + if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return ; } + if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { return ; } + if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { return ; } + if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { return ; } + if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { return ; } + if (cvtxtofmatched && !coll.selection_bit(aod::evsel::kIsVertexTOFmatched)) { return ; } + + if (std::abs(coll.posZ()) > cVtxZcut) { + return; + } - histos.fill(HIST("hVar1kx_gen"), sample_gen, nCh_gen, var1k_gen); - histos.fill(HIST("hVar2kx_gen"), sample_gen, nCh_gen, var2k_gen); - histos.fill(HIST("hVarkx_gen"), sample_gen, nChk_gen); - histos.fill(HIST("hVar2meanptkx_gen"), nCh_gen, var2k_gen); + if (!coll.sel8()) { return;} + float cent = coll.centFT0C(); + histos.fill(HIST("Rec/hZvtx_after_sel8"), coll.posZ()); + + + double nCh = 0., nChpi = 0., nChk = 0., nChp = 0., nCh_all = 0., nCh_all_bfcut = 0., nCh_eta = 0., nCh_pt = 0.; + double Q1 = 0., Q2 = 0., Q1_old = 0., Q2_old = 0.; + double Q1pi = 0., Q2pi = 0., Q1k = 0., Q2k = 0., Q1p = 0., Q2p = 0.; + double var1 = 0., var2 = 0., twopar_allcharge = 0., var1_old = 0., var2_old = 0.; + double var1pi = 0., var2pi = 0., var1k = 0., var2k = 0., var1p = 0., var2p = 0.; + double sum_pt_weight = 0., sum_weight = 0., sum_pt_pt_weight = 0., var1_eff = 0., var2_eff = 0.; - histos.fill(HIST("hVar1px_gen"), sample_gen, nCh_gen, var1p_gen); - histos.fill(HIST("hVar2px_gen"), sample_gen, nCh_gen, var2p_gen); - histos.fill(HIST("hVarpx_gen"), sample_gen, nChp_gen); - histos.fill(HIST("hVar2meanptpx_gen"), nCh_gen, var2p_gen); - } - PROCESS_SWITCH(IdentifiedMeanPtFluctuations, processMCGen, "process generated information", true); - //+++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++ - void process(aod::MyCollision const& coll, aod::MyTracks const& inputTracks) + int sample = histos.get(HIST("Rec/hZvtx_after_sel8"))->GetEntries(); + sample = sample % 30; - { - histos.fill(HIST("hEventCounter"), 1.); - histos.fill(HIST("hZvtx_before_sel"), coll.posZ()); - if (fabs(coll.posZ()) > 10.f) { - return; - } - histos.fill(HIST("hEventCounter"), 2.); + for (auto track : inputTracks) { - histos.fill(HIST("hZvtx_after_sel"), coll.posZ()); + nCh_all_bfcut += 1.; + histos.fill(HIST("Rec/hnch_all_bf_cut"), nCh_all_bfcut); - if (!coll.sel8()) { - return; - } - histos.fill(HIST("hZvtx_after_sel8"), coll.posZ()); + // histos.fill(HIST("Rec/tracksel"), 1); + histos.fill(HIST("Rec/hTPCchi2perCluster_before"), track.tpcChi2NCl()); + histos.fill(HIST("Rec/hITSchi2perCluster_before"), track.itsChi2NCl()); + histos.fill(HIST("Rec/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); - histos.fill(HIST("hEventCounter"), 3.); - const auto cent = coll.centFT0C(); - histos.fill(HIST("hCentrality"), cent); + if (std::fabs(track.eta()) <= cEtacut ) + { nCh_eta++; + histos.fill(HIST("Rec/hnch_true"), nCh_eta); + } - double nCh = 0.; - double nChpi = 0.; - double nChk = 0.; - double nChp = 0.; - double Q1 = 0., Q2 = 0.; - double Q1pi = 0., Q2pi = 0.; - double Q1k = 0., Q2k = 0.; - double Q1p = 0., Q2p = 0.; - double var1 = 0., var2 = 0., twopar_allcharge = 0.; - double var1pi = 0., var2pi = 0.; - double var1k = 0., var2k = 0.; - double var1p = 0., var2p = 0.; - // cent = 0; + if (track.pt() >= cPtmincut && track.pt() <= cPtmaxcut) + { nCh_pt += 1.; + histos.fill(HIST("Rec/hnch_true_pt"), nCh_pt); + } - // sampling - int sample = histos.get(HIST("hZvtx_after_sel8"))->GetEntries(); - sample = sample % 30; - // Perfroming the track selection========================================== - for (auto track : inputTracks) { - // Loop over tracks + if (!track.isGlobalTrack()) continue; + if (std::fabs(track.eta()) > cEtacut) continue; + if ((track.pt() <= cPtmincut) || (track.pt() >= cPtmaxcut)) continue; + if(track.sign() == 0) continue; + // if (std::fabs(track.y()) > 0.5) continue; + histos.fill(HIST("hPt_rec"), track.pt()); + histos.fill(HIST("hEta_rec"), track.eta()); - // inital tracks - histos.fill(HIST("tracksel"), 1); - histos.fill(HIST("hTPCchi2perCluster_before"), track.tpcChi2NCl()); - histos.fill(HIST("hITSchi2perCluster_before"), track.itsChi2NCl()); - histos.fill(HIST("hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); + auto mcParticle = track.mcParticle(); - // tracks passed after GlobalTrackcut - if (!track.isGlobalTrack()) - continue; - histos.fill(HIST("tracksel"), 2); + nCh_all += 1.; + histos.fill(HIST("Rec/hnch_all"), nCh_all); + histos.fill(HIST("ptHistogram_allcharge_rec"), track.pt()); - // tracks passed after DCAxy - // if (!(fabs(track.dcaXY()) < 0.12)) continue;//global cut already includes - histos.fill(HIST("tracksel"), 3); - // tracks passed after DCAz - // - histos.fill(HIST("hDCAxy"), track.dcaXY()); - histos.fill(HIST("hDCAz"), track.dcaZ()); + histos.fill(HIST("Rec/hDCAxy"), track.dcaXY()); + histos.fill(HIST("Rec/hDCAz"), track.dcaZ()); + histos.fill(HIST("Rec/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); + histos.fill(HIST("Rec/hTPCchi2perCluster_after"), track.tpcChi2NCl()); + histos.fill(HIST("Rec/hITSchi2perCluster_after"), track.itsChi2NCl()); + histos.fill(HIST("Rec/hP"), track.p()); + histos.fill(HIST("Rec/hPt"), track.pt()); + histos.fill(HIST("Rec/hEta"), track.eta()); + histos.fill(HIST("Rec/hPtDCAxy"), track.pt(), track.dcaXY()); + histos.fill(HIST("Rec/hPtDCAz"), track.pt(), track.dcaZ()); + histos.fill(HIST("Rec/hPtEta"), track.pt(), track.eta()); + histos.fill(HIST("Rec/hPEta"), track.p(), track.eta()); + histos.fill(HIST("Rec/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); - // if (!(fabs(track.dcaZ()) < 1.)) continue;//global cut already includes (DCAz< 2.0) cm - histos.fill(HIST("tracksel"), 4); - // tracks passed after Eta-cut - if (!(fabs(track.eta()) < 0.8)) - continue; - histos.fill(HIST("tracksel"), 5); + if (track.pt() >= 0.15 || track.pt() <= 2.0) //do not change this (it is for different pt work) + {nCh += 1.; + Q1_old += track.pt(); + Q2_old += (track.pt() * track.pt()); + histos.fill(HIST("Rec/hnch"), nCh); + } - // tracks passed after pT-cut - if (!(track.pt() > 0.15 && track.pt() < 2.)) - continue; // pt = 0.15 - histos.fill(HIST("tracksel"), 6); + Q1 += track.pt(); + Q2 += (track.pt() * track.pt()); - // if (track.tpcNClsCrossedRows() < 70.0) continue; - histos.fill(HIST("hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); - histos.fill(HIST("tracksel"), 7); - // if (track.tpcChi2NCl() > 4.0) continue; - histos.fill(HIST("hTPCchi2perCluster_after"), track.tpcChi2NCl()); - histos.fill(HIST("tracksel"), 8); + if (std::abs(mcParticle.pdgCode()) == 211) histos.fill(HIST("ptHistogramPionrec_pdg"), track.pt()); + if (std::abs(mcParticle.pdgCode()) == 321) histos.fill(HIST("ptHistogramKaonrec_pdg"),track.pt()); + if (std::abs(mcParticle.pdgCode()) == 2212) histos.fill(HIST("ptHistogramProtonrec_pdg"), track.pt()); - // if (track.itsChi2NCl() > 36.0) continue; - histos.fill(HIST("hITSchi2perCluster_after"), track.itsChi2NCl()); - histos.fill(HIST("tracksel"), 9); + if (cfgRejEl == false && rej_El(track)) { return; } - nCh += 1.; + // only TPC tracks: Pion, Kaon, Proton + if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < 3.) + histos.fill(HIST("Rec/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); + if (track.hasTPC() && std::abs(track.tpcNSigmaKa()) < 3.) + histos.fill(HIST("Rec/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); + if (track.hasTPC() && std::abs(track.tpcNSigmaPr()) < 3.) + histos.fill(HIST("Rec/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); - Q1 += track.pt(); - Q2 += (track.pt() * track.pt()); + + + // only TOF tracks: Pion, Kaon, Proton + if (track.hasTOF() && std::abs(track.tofNSigmaPi()) < 3.) + histos.fill(HIST("Rec/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); + if (track.hasTOF() && std::abs(track.tofNSigmaKa()) < 3.) + histos.fill(HIST("Rec/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); + if (track.hasTOF() && std::abs(track.tofNSigmaPr()) < 3.) + histos.fill(HIST("Rec/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); - histos.fill(HIST("hP"), track.p()); - histos.fill(HIST("hPt"), track.pt()); - histos.fill(HIST("hEta"), track.eta()); - histos.fill(HIST("hPtDCAxy"), track.pt(), track.dcaXY()); - histos.fill(HIST("hPtDCAz"), track.pt(), track.dcaZ()); + if (track.hasTPC()) histos.fill(HIST("Rec/hdEdx"), track.p(), track.tpcSignal()); + if (track.hasTOF()) histos.fill(HIST("Rec/hTOFbeta"), track.p(), track.beta()); - histos.fill(HIST("hPtEta"), track.pt(), track.eta()); - histos.fill(HIST("hPEta"), track.p(), track.eta()); - histos.fill(HIST("hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); + if (track.hasTPC()) histos.fill(HIST("hdEdx_afterselection_rec_beforepidcut"), track.p(), track.tpcSignal()); + if (track.hasTOF()) histos.fill(HIST("hTOFbeta_afterselection_rec_beforepidcut"), track.p(), track.beta()); - // only TPC tracks: Pion, Kaon, Proton - if (track.hasTPC() && abs(track.tpcNSigmaPi()) < 2.) - histos.fill(HIST("NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); - if (track.hasTPC() && abs(track.tpcNSigmaKa()) < 2.) - histos.fill(HIST("NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); - if (track.hasTPC() && abs(track.tpcNSigmaPr()) < 2.) - histos.fill(HIST("NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); - // only TOF tracks: Pion, Kaon, Proton - if (track.hasTOF() && abs(track.tofNSigmaPi()) < 2.) - histos.fill(HIST("NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); - if (track.hasTOF() && abs(track.tofNSigmaKa()) < 2.) - histos.fill(HIST("NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); - if (track.hasTOF() && abs(track.tofNSigmaPr()) < 2.) - histos.fill(HIST("NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); - - if (track.hasTPC()) - histos.fill(HIST("hdEdx"), track.p(), track.tpcSignal()); - if (track.hasTOF()) - histos.fill(HIST("hTOFbeta"), track.p(), track.beta()); - - //=============================pion============================================================== - // only TPC+TOF tracks: Pion, Kaon, Proton - if ((track.hasTPC() && abs(track.tpcNSigmaPi()) < 2.) && (track.hasTOF() && abs(track.tofNSigmaPi()) < 2.)) { - histos.fill(HIST("NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + //===================================pion============================================================== + if ((track.hasTPC() && std::abs(track.tpcNSigmaPi()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaPi()) < 3.)) { + histos.fill(HIST("Rec/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - histos.fill(HIST("hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection"), track.p(), track.beta()); + histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); } - // pion-TPC----------------------------------------------------------------------------------- - - if ((track.hasTPC() && abs(track.tpcNSigmaPi()) < 2. && (track.pt() >= 0.15 && track.pt() < 0.65) && (abs(track.rapidity(massPi)) < 0.5) && (std::abs(track.tpcNSigmaEl()) > 1.0 && std::abs(track.tpcNSigmaKa()) > 2.0 && std::abs(track.tpcNSigmaPr()) > 2.0))) { + - histos.fill(HIST("hPtPion"), track.pt()); - histos.fill(HIST("hEtaPion"), track.eta()); - histos.fill(HIST("hyPion"), track.rapidity(massPi)); - histos.fill(HIST("hPtyPion"), track.pt(), track.rapidity(massPi)); + if(sel_pion(track)) + { + if (std::fabs(track.y()) > 0.5) continue; - nChpi += 1.; - Q1pi += track.pt(); - Q2pi += (track.pt() * track.pt()); + if (track.beta() > 1) continue; + histos.fill(HIST("ptHistogramPionrec"), track.pt()); - if (track.beta() > 1) - continue; + histos.fill(HIST("Rec/hPtPion"), track.pt()); + histos.fill(HIST("Rec/hEtaPion"), track.eta()); + histos.fill(HIST("Rec/hyPion"), track.rapidity(massPi)); + histos.fill(HIST("Rec/hPtyPion"), track.pt(), track.rapidity(massPi)); - histos.fill(HIST("hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection1"), track.p(), track.beta()); - } + histos.fill(HIST("NSigamaTPCpion_rec"), track.p(), track.tpcNSigmaPi()); + histos.fill(HIST("NSigamaTOFpion_rec"), track.p(), track.tofNSigmaPi()); + histos.fill(HIST("NSigamaTPCTOFpion_rec"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - // pion->(TPC+TOF)------------------------------------------------------------------------------------ - if ((track.pt() >= 0.65 && track.pt() < 2.0) && (abs(track.rapidity(massPi)) < 0.5) && track.hasTPC() && track.hasTOF() && (std::abs(track.tofNSigmaKa()) > 2.0 && std::abs(track.tofNSigmaPr()) > 2.0) && abs(sqrt(track.tpcNSigmaPi()) * (track.tpcNSigmaPi()) + (track.tofNSigmaPi()) * (track.tofNSigmaPi())) < 2.) { + histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); - histos.fill(HIST("hPtPion"), track.pt()); - histos.fill(HIST("hEtaPion"), track.eta()); - histos.fill(HIST("hyPion"), track.rapidity(massPi)); - histos.fill(HIST("hPtyPion"), track.pt(), track.rapidity(massPi)); + if (std::abs(track.mcParticle().pdgCode()) == 211) + { histos.fill(HIST("ptHistogramPionrec_purity"), track.pt()); } nChpi += 1.; Q1pi += track.pt(); Q2pi += (track.pt() * track.pt()); - if (track.beta() > 1) - continue; + histos.fill(HIST("hPyPion_rec"), track.p(), track.rapidity(massPi)); + histos.fill(HIST("hPtyPion_rec"), track.pt(), track.rapidity(massPi)); - histos.fill(HIST("hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection1"), track.p(), track.beta()); - } - //===========================kaon=============================================================== + } - if ((track.hasTPC() && abs(track.tpcNSigmaKa()) < 2.) && (track.hasTOF() && abs(track.tofNSigmaKa()) < 2.)) { - histos.fill(HIST("NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - histos.fill(HIST("hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection"), track.p(), track.beta()); - } +//===========================kaon=============================================================== - if (track.hasTPC() && abs(track.tpcNSigmaKa()) < 2. && (track.pt() >= 0.15 && track.pt() < 0.65) && (abs(track.rapidity(massKa)) < 0.5) && (std::abs(track.tpcNSigmaEl()) > 1.0 && std::abs(track.tpcNSigmaPi()) > 2.0 && std::abs(track.tpcNSigmaPr()) > 2.0)) { + if ((track.hasTPC() && std::abs(track.tpcNSigmaKa()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaKa()) < 3.)) { + histos.fill(HIST("Rec/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); + } - histos.fill(HIST("hPtKaon"), track.pt()); - histos.fill(HIST("hEtaKaon"), track.eta()); - histos.fill(HIST("hyKaon"), track.rapidity(massKa)); - histos.fill(HIST("hPtyKaon"), track.pt(), track.rapidity(massKa)); + if(sel_kaon(track)) + { + if (std::fabs(track.y()) > 0.5) continue; - nChk += 1.; - Q1k += track.pt(); - Q2k += (track.pt() * track.pt()); + if (track.beta() > 1) continue; + histos.fill(HIST("ptHistogramKaonrec"), track.pt()); - if (track.beta() > 1) - continue; + histos.fill(HIST("Rec/hPtKaon"), track.pt()); + histos.fill(HIST("Rec/hEtaKaon"), track.eta()); + histos.fill(HIST("Rec/hyKaon"), track.rapidity(massKa)); + histos.fill(HIST("Rec/hPtyKaon"), track.pt(), track.rapidity(massKa)); - histos.fill(HIST("hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection1"), track.p(), track.beta()); - } + histos.fill(HIST("NSigamaTPCkaon_rec"), track.p(), track.tpcNSigmaKa()); + histos.fill(HIST("NSigamaTOFkaon_rec"), track.p(), track.tofNSigmaKa()); + histos.fill(HIST("NSigamaTPCTOFkaon_rec"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - if ((track.pt() >= 0.65 && track.pt() < 2.0) && (abs(track.rapidity(massKa)) < 0.5) && track.hasTPC() && track.hasTOF() && (std::abs(track.tofNSigmaPi()) > 2.0 && std::abs(track.tofNSigmaPr()) > 2.0) && (abs(sqrt(track.tpcNSigmaKa()) * (track.tpcNSigmaKa()) + (track.tofNSigmaKa()) * (track.tofNSigmaKa())) < 2.)) { + histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); - histos.fill(HIST("hPtKaon"), track.pt()); - histos.fill(HIST("hEtaKaon"), track.eta()); - histos.fill(HIST("hyKaon"), track.rapidity(massKa)); - histos.fill(HIST("hPtyKaon"), track.pt(), track.rapidity(massKa)); + if (std::abs(track.mcParticle().pdgCode()) == 321) + { histos.fill(HIST("ptHistogramKaonrec_purity"), track.pt()); } nChk += 1.; Q1k += track.pt(); Q2k += (track.pt() * track.pt()); - if (track.beta() > 1) - continue; + histos.fill(HIST("hPyKaon_rec"), track.p(), track.rapidity(massKa)); + histos.fill(HIST("hPtyKaon_rec"), track.pt(), track.rapidity(massKa)); + } - histos.fill(HIST("hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection1"), track.p(), track.beta()); - } + //============================proton=========================================================== - //============================proton=========================================================== - if ((track.hasTPC() && abs(track.tpcNSigmaPr()) < 2.) && (track.hasTOF() && abs(track.tofNSigmaPr()) < 2.)) { - histos.fill(HIST("NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + if ((track.hasTPC() && std::abs(track.tpcNSigmaPr()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaPr()) < 3.)) { + histos.fill(HIST("Rec/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - histos.fill(HIST("hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection"), track.p(), track.beta()); + histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); } - if (track.hasTPC() && abs(track.tpcNSigmaPr()) < 2. && (track.pt() >= 0.4 && track.pt() < 0.85) && (abs(track.rapidity(massPr)) < 0.5) && (std::abs(track.tpcNSigmaEl()) > 1.0 && std::abs(track.tpcNSigmaKa()) > 2.0 && std::abs(track.tpcNSigmaPi()) > 2.0)) { - - histos.fill(HIST("hPtProton"), track.pt()); - histos.fill(HIST("hEtaProton"), track.eta()); - histos.fill(HIST("hyProton"), track.rapidity(massPr)); - histos.fill(HIST("hPtyProton"), track.pt(), track.rapidity(massPr)); + if(sel_proton(track)) + { + if (std::fabs(track.y()) > 0.5) continue; - nChp += 1.; - Q1p += track.pt(); - Q2p += (track.pt() * track.pt()); + if (track.beta() > 1) continue; + histos.fill(HIST("ptHistogramProtonrec"), track.pt()); - if (track.beta() > 1) - continue; + histos.fill(HIST("Rec/hPtProton"), track.pt()); + histos.fill(HIST("Rec/hEtaProton"), track.eta()); + histos.fill(HIST("Rec/hyProton"), track.rapidity(massPr)); + histos.fill(HIST("Rec/hPtyProton"), track.pt(), track.rapidity(massPr)); - histos.fill(HIST("hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection1"), track.p(), track.beta()); - } + histos.fill(HIST("NSigamaTPCproton_rec"), track.p(), track.tpcNSigmaPr()); + histos.fill(HIST("NSigamaTOFproton_rec"), track.p(), track.tofNSigmaPr()); + histos.fill(HIST("NSigamaTPCTOFproton_rec"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - if ((track.pt() >= 0.85 && track.pt() < 2.0) && (abs(track.rapidity(massPr)) < 0.5) && track.hasTPC() && track.hasTOF() && (std::abs(track.tofNSigmaKa()) > 2.0 && std::abs(track.tofNSigmaPi()) > 2.0) && (abs(sqrt(track.tpcNSigmaPr()) * (track.tpcNSigmaPr()) + (track.tofNSigmaPr()) * (track.tofNSigmaPr())) < 2.)) { + histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); - histos.fill(HIST("hPtProton"), track.pt()); - histos.fill(HIST("hEtaProton"), track.eta()); - histos.fill(HIST("hyProton"), track.rapidity(massPr)); - histos.fill(HIST("hPtyProton"), track.pt(), track.rapidity(massPr)); + if (std::abs(track.mcParticle().pdgCode()) == 2212) + { histos.fill(HIST("ptHistogramProtonrec_purity"), track.pt()); } nChp += 1.; Q1p += track.pt(); Q2p += (track.pt() * track.pt()); - if (track.beta() > 1) - continue; + histos.fill(HIST("hPyProton_rec"), track.p(), track.rapidity(massPr)); + histos.fill(HIST("hPtyProton_rec"), track.pt(), track.rapidity(massPr)); + } + + + }//loop over tracks + histos.fill(HIST("Rec/hcent_nacc"), cent, nCh_all); + + if (nCh >= 2.0) + { + var1_old = (Q1_old * Q1_old - Q2_old) / (nCh * (nCh - 1)); + var2_old = (Q1_old / nCh); + } - histos.fill(HIST("hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("hTOFbeta_afterselection1"), track.p(), track.beta()); - } - //==================================================================================================== - } - // Track loop ends! - if (nCh < 2) - return; + if (nCh_all < 2.0) return; + var1 = (Q1 * Q1 - Q2) / (nCh_all * (nCh_all - 1)); + var2 = (Q1 / nCh_all); - //------------------ all charges------------------------------------- - var1 = (Q1 * Q1 - Q2) / (nCh * (nCh - 1)); - histos.fill(HIST("hVar1"), sample, cent, var1); - var2 = (Q1 / nCh); - histos.fill(HIST("hVar2"), sample, cent, var2); - histos.fill(HIST("hVarc"), sample, cent); - histos.fill(HIST("hVar2meanpt"), cent, var2); + + + histos.fill(HIST("Rec/hVar1"), sample, cent, var1); + histos.fill(HIST("Rec/hVar2"), sample, cent, var2); + histos.fill(HIST("Rec/hVarc"), sample, cent); + histos.fill(HIST("Rec/hVar2meanpt"), cent, var2); twopar_allcharge = (var1 - var2); - histos.fill(HIST("hVar"), nCh, twopar_allcharge); + histos.fill(HIST("Rec/hVar"), nCh_all, twopar_allcharge); //---------------------- pions ---------------------------------------- - if (nChpi > 2) { + if (nChpi >= 2.0) { var1pi = (Q1pi * Q1pi - Q2pi) / (nChpi * (nChpi - 1)); var2pi = (Q1pi / nChpi); - } + } //----------------------- kaons --------------------------------------- - if (nChk > 2) { + if (nChk >= 2.0) { var1k = (Q1k * Q1k - Q2k) / (nChk * (nChk - 1)); var2k = (Q1k / nChk); - } + } //---------------------------- protons ---------------------------------- - if (nChp > 2) { + if (nChp >= 2.0) { var1p = (Q1p * Q1p - Q2p) / (nChp * (nChp - 1)); var2p = (Q1p / nChp); - } + } + //========================centrality========================================== - //========================centrality========================================== + histos.fill(HIST("Rec/hVar1pi"), sample, cent, var1pi); + histos.fill(HIST("Rec/hVar2pi"), sample, cent, var2pi); + histos.fill(HIST("Rec/hVar2meanptpi"), cent, var2pi); - histos.fill(HIST("hVar1pi"), sample, cent, var1pi); - histos.fill(HIST("hVar2pi"), sample, cent, var2pi); - histos.fill(HIST("hVar2meanptpi"), cent, var2pi); + histos.fill(HIST("Rec/hVar1k"), sample, cent, var1k); + histos.fill(HIST("Rec/hVar2k"), sample, cent, var2k); + histos.fill(HIST("Rec/hVar2meanptk"), cent, var2k); - histos.fill(HIST("hVar1k"), sample, cent, var1k); - histos.fill(HIST("hVar2k"), sample, cent, var2k); - histos.fill(HIST("hVar2meanptk"), cent, var2k); + histos.fill(HIST("Rec/hVar1p"), sample, cent, var1p); + histos.fill(HIST("Rec/hVar2p"), sample, cent, var2p); + histos.fill(HIST("Rec/hVar2meanptp"), cent, var2p); - histos.fill(HIST("hVar1p"), sample, cent, var1p); - histos.fill(HIST("hVar2p"), sample, cent, var2p); - histos.fill(HIST("hVar2meanptp"), cent, var2p); + //-----------------------nch------------------------------------- + + + histos.fill(HIST("Rec/hVar1x"), sample, nCh_all, var1); + histos.fill(HIST("Rec/hVar2x"), sample, nCh_all, var2); + histos.fill(HIST("Rec/hVarx"), sample, nCh_all); + histos.fill(HIST("Rec/hVar2meanptx"), nCh_all, var2); + + histos.fill(HIST("Rec/hVar1pix"), sample, nCh_all, var1pi); + histos.fill(HIST("Rec/hVar2pix"), sample, nCh_all, var2pi); + histos.fill(HIST("Rec/hVarpix"), sample, nChpi); + histos.fill(HIST("Rec/hVar2meanptpix"), nCh_all, var2pi); + + histos.fill(HIST("Rec/hVar1kx"), sample, nCh_all, var1k); + histos.fill(HIST("Rec/hVar2kx"), sample, nCh_all, var2k); + histos.fill(HIST("Rec/hVarkx"), sample, nChk); + histos.fill(HIST("Rec/hVar2meanptkx"), nCh_all, var2k); + + histos.fill(HIST("Rec/hVar1px"), sample, nCh_all, var1p); + histos.fill(HIST("Rec/hVar2px"), sample, nCh_all, var2p); + histos.fill(HIST("Rec/hVarpx"), sample, nChp); + histos.fill(HIST("Rec/hVar2meanptpx"), nCh_all, var2p); + + +//================= generated levels============================== + const auto& mccolgen = coll.mcCollision_as(); + if (std::abs(mccolgen.posZ()) > cVtxZcut) { return; } + const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); + histos.fill(HIST("hVtxZ_after_gen"), mccolgen.posZ()); + + double nCh_gen = 0., nCh_gen_all = 0., nCh_gen_true = 0.; + double nChpi_gen = 0., nChk_gen = 0., nChp_gen = 0.; + double nCh1 = 0., nCh2 = 0., nCh3 = 0., nCh4 = 0.; + + double Q1_gen = 0, Q2_gen = 0., Q1_gen_old = 0., Q2_gen_old = 0.; + double Q1pi_gen = 0, Q2pi_gen = 0, Q1k_gen = 0, Q2k_gen = 0, Q1p_gen = 0, Q2p_gen = 0 ; + + double var1_gen = 0, var2_gen = 0., var1_gen_old = 0., var2_gen_old = 0.; + double var1pi_gen = 0, var2pi_gen = 0, var1k_gen = 0, var2k_gen = 0, var1p_gen = 0, var2p_gen = 0; + + int sample_gen = histos.get(HIST("hVtxZ_after_gen"))->GetEntries(); + sample_gen = sample_gen % 30; + + + for (const auto& mcpart:mcpartgen){ + auto pdgcode = std::abs(mcpart.pdgCode()); + + if(!mcpart.isPhysicalPrimary()) {continue;} + nCh1++ ; + histos.fill(HIST("hnch1"), nCh1); +// if (!(pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == -211 || pdgcode == -321 || pdgcode == -2212 || pdgcode == 11 || pdgcode == 13)) continue; + nCh2++ ; + + histos.fill(HIST("hnch2"), nCh2); + + nCh3++ ; + histos.fill(HIST("hnch3"), nCh3); + + + + int pid = mcpart.pdgCode(); + auto sign = 0; + auto* pd = pdg->GetParticle(pid); + if (pd != nullptr) { + sign = pd->Charge()/3.; + } + if (sign == 0 ) { continue;} +// histos.fill(HIST("gen_hSign"), sign); + if (std::fabs(mcpart.eta()) > cEtacut) continue; + nCh_gen_true++; + histos.fill(HIST("hnch_gen_true"), nCh_gen_true); + + if ((mcpart.pt() <= cPtmincut) || (mcpart.pt() >= cPtmaxcut)) continue; + + histos.fill(HIST("hPt_gen"), mcpart.pt()); + histos.fill(HIST("hEta_gen"), mcpart.eta()); + + histos.fill(HIST("ptHistogram_allcharge_gen"), mcpart.pt()); + + + nCh_gen_all += 1.; + Q1_gen += mcpart.pt(); + Q2_gen += (mcpart.pt() * mcpart.pt()); + + histos.fill(HIST("hnch_gen_all"), nCh_gen_all); + + if (std::fabs(mcpart.y()) < 0.5) + { + if (mcpart.pdgCode() == 211 || mcpart.pdgCode() == -211 ) + { + histos.fill(HIST("ptHistogramPion"), mcpart.pt()); + nChpi_gen += 1.; + Q1pi_gen += mcpart.pt(); + Q2pi_gen += (mcpart.pt() * mcpart.pt()); + histos.fill(HIST("hnch_pi"), nChpi_gen); + + } + + if (mcpart.pdgCode() == 321 || mcpart.pdgCode() == -321) + { + histos.fill(HIST("ptHistogramKaon"), mcpart.pt()); + nChk_gen += 1.; + Q1k_gen += mcpart.pt(); + Q2k_gen += (mcpart.pt() * mcpart.pt()); + histos.fill(HIST("hnch_ka"), nChk_gen); + + + } + + if (mcpart.pdgCode() == 2212 || mcpart.pdgCode() == -2212) + { + histos.fill(HIST("ptHistogramProton"), mcpart.pt()); + nChp_gen += 1.; + Q1p_gen += mcpart.pt(); + Q2p_gen += (mcpart.pt() * mcpart.pt()); + histos.fill(HIST("hnch_pr"), nChp_gen); + + } + + }//|y| < 0.5 cut ends! + + }//particle + histos.fill(HIST("hcent_nacc_gen"), cent, nCh_gen); + + + if (nCh_gen_all < 2.0) return; + var1_gen = (Q1_gen * Q1_gen - Q2_gen) / (nCh_gen_all * (nCh_gen_all - 1)); + var2_gen = (Q1_gen / nCh_gen_all); + + if (nChpi_gen >= 2.0) + { + var1pi_gen = (Q1pi_gen * Q1pi_gen - Q2pi_gen) / (nChpi_gen * (nChpi_gen - 1)); + var2pi_gen = (Q1pi_gen / nChpi_gen); + } + + //----------------------- kaons --------------------------------------- + if (nChk_gen >= 2.0) + { + var1k_gen = (Q1k_gen * Q1k_gen - Q2k_gen) / (nChk_gen * (nChk_gen - 1)); + var2k_gen = (Q1k_gen / nChk_gen); + } + + //---------------------------- protons ---------------------------------- + if (nChp_gen >= 2.0) + { + var1p_gen = (Q1p_gen * Q1p_gen - Q2p_gen) / (nChp_gen * (nChp_gen - 1)); + var2p_gen = (Q1p_gen / nChp_gen); + } //-----------------------nch------------------------------------- - histos.fill(HIST("hVar1x"), sample, nCh, var1); - histos.fill(HIST("hVar2x"), sample, nCh, var2); - histos.fill(HIST("hVarx"), sample, nCh); - histos.fill(HIST("hVar2meanptx"), nCh, var2); - - histos.fill(HIST("hVar1pix"), sample, nCh, var1pi); - histos.fill(HIST("hVar2pix"), sample, nCh, var2pi); - histos.fill(HIST("hVarpix"), sample, nChpi); - histos.fill(HIST("hVar2meanptpix"), nCh, var2pi); - - histos.fill(HIST("hVar1kx"), sample, nCh, var1k); - histos.fill(HIST("hVar2kx"), sample, nCh, var2k); - histos.fill(HIST("hVarkx"), sample, nChk); - histos.fill(HIST("hVar2meanptkx"), nCh, var2k); - - histos.fill(HIST("hVar1px"), sample, nCh, var1p); - histos.fill(HIST("hVar2px"), sample, nCh, var2p); - histos.fill(HIST("hVarpx"), sample, nChp); - histos.fill(HIST("hVar2meanptpx"), nCh, var2p); - } // event loop ends! + histos.fill(HIST("hVar1x_gen"), sample_gen, nCh_gen_all, var1_gen); + histos.fill(HIST("hVar2x_gen"), sample_gen, nCh_gen_all, var2_gen); + histos.fill(HIST("hVarx_gen"), sample_gen, nCh_gen_all); + histos.fill(HIST("hVar2meanptx_gen"), nCh_gen_all, var2_gen); + + histos.fill(HIST("hVar1pix_gen"), sample_gen, nCh_gen_all, var1pi_gen); + histos.fill(HIST("hVar2pix_gen"), sample_gen, nCh_gen_all, var2pi_gen); + histos.fill(HIST("hVarpix_gen"), sample_gen, nChpi_gen); + histos.fill(HIST("hVar2meanptpix_gen"), nCh_gen_all, var2pi_gen); + + histos.fill(HIST("hVar1kx_gen"), sample_gen, nCh_gen_all, var1k_gen); + histos.fill(HIST("hVar2kx_gen"), sample_gen, nCh_gen_all, var2k_gen); + histos.fill(HIST("hVarkx_gen"), sample_gen, nChk_gen); + histos.fill(HIST("hVar2meanptkx_gen"), nCh_gen_all, var2k_gen); + + histos.fill(HIST("hVar1px_gen"), sample_gen, nCh_gen_all, var1p_gen); + histos.fill(HIST("hVar2px_gen"), sample_gen, nCh_gen_all, var2p_gen); + histos.fill(HIST("hVarpx_gen"), sample_gen, nChp_gen); + histos.fill(HIST("hVar2meanptpx_gen"), nCh_gen_all, var2p_gen); + + + } //void process +PROCESS_SWITCH(IdentifiedMeanPtFluctuations, processMcReco, "Process reconstructed", true); - PROCESS_SWITCH(IdentifiedMeanPtFluctuations, process, "process real data information", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) @@ -1171,3 +1454,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; return workflow; } + + + diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index a2eeee342ed..a5bf9bec9ee 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -64,18 +64,6 @@ DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); } // namespace net_charge -namespace net_charge_rec -{ -DECLARE_SOA_COLUMN(PosCharge, posCharge, float); -DECLARE_SOA_COLUMN(NegCharge, negCharge, float); -DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negSqCharge, float); -DECLARE_SOA_COLUMN(TermPCharge, termPCharge, float); -DECLARE_SOA_COLUMN(TermNCharge, termNCharge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); -DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace net_charge_rec - namespace net_charge_gen { DECLARE_SOA_COLUMN(PosCharge, posCharge, float); @@ -98,16 +86,6 @@ DECLARE_SOA_TABLE(NetCharge, "AOD", "NETChargefluct", net_charge::PosNegCharge, net_charge::Centrality); -DECLARE_SOA_TABLE(NetChargeRec, "AOD", "NETfluctRec", - net_charge_rec::PosCharge, - net_charge_rec::NegCharge, - net_charge_rec::PosSqCharge, - net_charge_rec::NegSqCharge, - net_charge_rec::TermPCharge, - net_charge_rec::TermNCharge, - net_charge_rec::PosNegCharge, - net_charge_rec::Centrality); - DECLARE_SOA_TABLE(NetChargeGen, "AOD", "NETfluctGen", net_charge_gen::PosCharge, net_charge_gen::NegCharge, @@ -143,7 +121,6 @@ enum RunType { struct NetchargeFluctuations { Produces netCharge; - Produces netChargeRec; Produces netChargeGen; Service pdgService; @@ -470,8 +447,8 @@ struct NetchargeFluctuations { posNegRec = posRec * negRec; - netChargeRec(posRec, negRec, posRec * posRec, negRec * negRec, - termPRec, termNRec, posNegRec, cent); + netCharge(posRec, negRec, posRec * posRec, negRec * negRec, + termPRec, termNRec, posNegRec, cent); } // loop over inputTracks (reco) for (const auto& mcpart : mcpartgen) { @@ -554,10 +531,11 @@ struct NetchargeFluctuations { }; // struct struct NetchargeAnalysis { - Configurable cfSubSample{"cfSubSample", 20, "Number of subsamples"}; + Configurable cfSubSample{"cfSubSample", 30, "Number of subsamples"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; std::vector>> net; std::vector>> subSample; + std::vector>> genSubSample; TRandom3* fRndm = new TRandom3(0); void init(o2::framework::InitContext&) @@ -565,38 +543,57 @@ struct NetchargeAnalysis { std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; AxisSpec centAxis = {centBinning, "centrality"}; - registry.add("pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("data/pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("data/neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("data/termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("data/termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("data/pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("data/neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("data/posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + + registry.add("gen/pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("gen/neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("gen/termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("gen/termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("gen/pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("gen/neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.add("gen/posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); subSample.resize(cfSubSample); + genSubSample.resize(cfSubSample); for (int i = 0; i < cfSubSample; ++i) { subSample[i].resize(7); - subSample[i][0] = std::get>(registry.add(Form("subSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][1] = std::get>(registry.add(Form("subSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][2] = std::get>(registry.add(Form("subSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][3] = std::get>(registry.add(Form("subSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][4] = std::get>(registry.add(Form("subSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][5] = std::get>(registry.add(Form("subSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][6] = std::get>(registry.add(Form("subSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + genSubSample[i].resize(7); + + subSample[i][0] = std::get>(registry.add(Form("data/subSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][1] = std::get>(registry.add(Form("data/subSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][2] = std::get>(registry.add(Form("data/subSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][3] = std::get>(registry.add(Form("data/subSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][4] = std::get>(registry.add(Form("data/subSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][5] = std::get>(registry.add(Form("data/subSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + subSample[i][6] = std::get>(registry.add(Form("data/subSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + + genSubSample[i][0] = std::get>(registry.add(Form("gen/genSubSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + genSubSample[i][1] = std::get>(registry.add(Form("gen/genSubSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + genSubSample[i][2] = std::get>(registry.add(Form("gen/genSubSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + genSubSample[i][3] = std::get>(registry.add(Form("gen/genSubSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + genSubSample[i][4] = std::get>(registry.add(Form("gen/genSubSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + genSubSample[i][5] = std::get>(registry.add(Form("gen/genSubSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + genSubSample[i][6] = std::get>(registry.add(Form("gen/genSubSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); } } // void - void process(aod::NetCharge::iterator const& event_netcharge) + void processData(aod::NetCharge::iterator const& event_netcharge) { - registry.get(HIST("pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - registry.get(HIST("neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - registry.get(HIST("termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); - registry.get(HIST("termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); - registry.get(HIST("pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); - registry.get(HIST("neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); - registry.get(HIST("posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); + registry.get(HIST("data/pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); + registry.get(HIST("data/neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); + registry.get(HIST("data/termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); + registry.get(HIST("data/termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); + registry.get(HIST("data/pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); + registry.get(HIST("data/neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); + registry.get(HIST("data/posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); int sampleIndex = static_cast(cfSubSample * fRndm->Rndm()); subSample[sampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); @@ -607,134 +604,36 @@ struct NetchargeAnalysis { subSample[sampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); subSample[sampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); } // void + PROCESS_SWITCH(NetchargeAnalysis, processData, "Process reconstructed and Data", true); -}; // struct Netcharge_analysis - -struct NetchargeAnalysisRec { - Configurable cfSubSample{"cfSubSample", 20, "Number of subsamples"}; - - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - std::vector>> net; - std::vector>> subSample; - TRandom3* fRndm = new TRandom3(0); - - void init(o2::framework::InitContext&) + void processGen(aod::NetChargeGen::iterator const& event_netcharge) { - std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; - AxisSpec centAxis = {centBinning, "centrality"}; - - registry.add("pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); + registry.get(HIST("gen/pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); + registry.get(HIST("gen/neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); + registry.get(HIST("gen/termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); + registry.get(HIST("gen/termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); + registry.get(HIST("gen/pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); + registry.get(HIST("gen/neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); + registry.get(HIST("gen/posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); - subSample.resize(cfSubSample); - for (int i = 0; i < cfSubSample; i++) { - subSample[i].resize(7); - } - - for (int i = 0; i < cfSubSample; i++) { - subSample[i][0] = std::get>(registry.add(Form("subSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][1] = std::get>(registry.add(Form("subSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][2] = std::get>(registry.add(Form("subSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][3] = std::get>(registry.add(Form("subSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][4] = std::get>(registry.add(Form("subSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][5] = std::get>(registry.add(Form("subSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][6] = std::get>(registry.add(Form("subSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - } - } // void - - void process(aod::NetChargeRec::iterator const& rec_netcharge) - { - registry.get(HIST("pos_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posCharge()); - registry.get(HIST("neg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.negCharge()); - registry.get(HIST("termp_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termPCharge()); - registry.get(HIST("termn_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.termNCharge()); - registry.get(HIST("pos_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posSqCharge()); - registry.get(HIST("neg_sq_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.negSqCharge()); - registry.get(HIST("posneg_vs_cent"))->Fill(rec_netcharge.centrality(), rec_netcharge.posNegCharge()); - - float randValue = fRndm->Rndm(); - int sampleIndex = static_cast(cfSubSample * randValue); - subSample[sampleIndex][0]->Fill(rec_netcharge.centrality(), rec_netcharge.posCharge()); - subSample[sampleIndex][1]->Fill(rec_netcharge.centrality(), rec_netcharge.negCharge()); - subSample[sampleIndex][2]->Fill(rec_netcharge.centrality(), rec_netcharge.termPCharge()); - subSample[sampleIndex][3]->Fill(rec_netcharge.centrality(), rec_netcharge.termNCharge()); - subSample[sampleIndex][4]->Fill(rec_netcharge.centrality(), rec_netcharge.posSqCharge()); - subSample[sampleIndex][5]->Fill(rec_netcharge.centrality(), rec_netcharge.negSqCharge()); - subSample[sampleIndex][6]->Fill(rec_netcharge.centrality(), rec_netcharge.posNegCharge()); - } // void -}; // struct rec - -struct NetchargeAnalysisGen { - Configurable cfSubSample{"cfSubSample", 20, "Number of subsamples"}; - - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - std::vector>> net; - std::vector>> subSample; - TRandom3* fRndm = new TRandom3(0); - - void init(o2::framework::InitContext&) - { - std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; - AxisSpec centAxis = {centBinning, "centrality"}; - - registry.add("pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - - subSample.resize(cfSubSample); - for (int i = 0; i < cfSubSample; i++) { - subSample[i].resize(7); - } - - for (int i = 0; i < cfSubSample; i++) { - subSample[i][0] = std::get>(registry.add(Form("subSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][1] = std::get>(registry.add(Form("subSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][2] = std::get>(registry.add(Form("subSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][3] = std::get>(registry.add(Form("subSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][4] = std::get>(registry.add(Form("subSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][5] = std::get>(registry.add(Form("subSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][6] = std::get>(registry.add(Form("subSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - } + int sampleIndex = static_cast(cfSubSample * fRndm->Rndm()); + genSubSample[sampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); + genSubSample[sampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); + genSubSample[sampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); + genSubSample[sampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); + genSubSample[sampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); + genSubSample[sampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); + genSubSample[sampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); } // void + PROCESS_SWITCH(NetchargeAnalysis, processGen, "Process generated", true); - void process(aod::NetChargeGen::iterator const& gen_netcharge) - { - registry.get(HIST("pos_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posCharge()); - registry.get(HIST("neg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.negCharge()); - registry.get(HIST("termp_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termPCharge()); - registry.get(HIST("termn_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.termNCharge()); - registry.get(HIST("pos_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posSqCharge()); - registry.get(HIST("neg_sq_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.negSqCharge()); - registry.get(HIST("posneg_vs_cent"))->Fill(gen_netcharge.centrality(), gen_netcharge.posNegCharge()); - - float randValue = fRndm->Rndm(); - int sampleIndex = static_cast(cfSubSample * randValue); - subSample[sampleIndex][0]->Fill(gen_netcharge.centrality(), gen_netcharge.posCharge()); - subSample[sampleIndex][1]->Fill(gen_netcharge.centrality(), gen_netcharge.negCharge()); - subSample[sampleIndex][2]->Fill(gen_netcharge.centrality(), gen_netcharge.termPCharge()); - subSample[sampleIndex][3]->Fill(gen_netcharge.centrality(), gen_netcharge.termNCharge()); - subSample[sampleIndex][4]->Fill(gen_netcharge.centrality(), gen_netcharge.posSqCharge()); - subSample[sampleIndex][5]->Fill(gen_netcharge.centrality(), gen_netcharge.negSqCharge()); - subSample[sampleIndex][6]->Fill(gen_netcharge.centrality(), gen_netcharge.posNegCharge()); - } // void -}; // struct +}; // struct Netcharge_analysis WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ {adaptAnalysisTask(cfgc)}, - {adaptAnalysisTask(cfgc)}, - {adaptAnalysisTask(cfgc)}, - {adaptAnalysisTask(cfgc)} + {adaptAnalysisTask(cfgc)} }; } From c0cbe833a9419db4408ba58cca2d558f964ffe8c Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Thu, 5 Jun 2025 18:20:50 +0530 Subject: [PATCH 12/14] cfnetchargfluctu --- .../Tasks/IdentifiedMeanPtFluctuations.cxx | 1459 ----------------- 1 file changed, 1459 deletions(-) delete mode 100644 PWGCF/EbyEFluctuations/Tasks/IdentifiedMeanPtFluctuations.cxx diff --git a/PWGCF/EbyEFluctuations/Tasks/IdentifiedMeanPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/IdentifiedMeanPtFluctuations.cxx deleted file mode 100644 index f4da22e1c87..00000000000 --- a/PWGCF/EbyEFluctuations/Tasks/IdentifiedMeanPtFluctuations.cxx +++ /dev/null @@ -1,1459 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -// author Sweta Singh (sweta.singh@cern.ch) -// Department of Physics, Aligarh Muslim University, India -// to study the two particle correaltor on Run 3data - - -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \author Sweta Singh (sweta.singh@cern.ch) -// Mean pT fluctautions usin - -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/trackUtilities.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" -#include "CommonConstants/MathConstants.h" -#include "Common/DataModel/FT0Corrected.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "PWGCF/Core/CorrelationContainer.h" -#include "PWGCF/Core/PairCuts.h" -#include "TDatabasePDG.h" -#include -#include "Common/CCDB/TriggerAliases.h" -#include "CCDB/BasicCCDBManager.h" -#include "Framework/O2DatabasePDGPlugin.h" - - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace std; - -#include -#include -#include -#include - -namespace o2::aod -{ -using MyCollisions = soa::Join; -using MyTracks = soa::Join; - -using MyMCRecoCollisions = soa::Join; -using MyMCRecoCollision = MyMCRecoCollisions::iterator; - -using MyMCRecoTracks = soa::Join; -using MyMCRecoTrack = MyMCRecoTracks::iterator; - -using EventCandidatesMC = soa::Join; -using MyCollision = MyCollisions::iterator; -using MyTrack = MyTracks::iterator; -} // namespace o2::aod - -double massPi = TDatabasePDG::Instance()->GetParticle(211)->Mass(); -double massKa = TDatabasePDG::Instance()->GetParticle(321)->Mass(); -double massPr = TDatabasePDG::Instance()->GetParticle(2212)->Mass(); - -struct IdentifiedMeanPtFluctuations{ - Service ccdb; - Service pdg; - - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - - - Configurable ptMax{"ptMax", 2.0, "maximum pT"}; - Configurable ptMin{"ptMin", 0.15, "minimum pT"}; - Configurable> ptBins{"ptBins", {0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.05, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00}, "p_{T} bins"}; - - - Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; - - void init(o2::framework::InitContext&) - { - - - std::vector ptBinning = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0}; - // AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec vtxZAxis = {100, -20.0, 20.0, "Z (cm)"}; - AxisSpec dcaAxis = {1002, -5.01, 5.01, "DCA_{xy} (cm)"}; - AxisSpec dcazAxis = {1002, -5.01, 5.01, "DCA_{z} (cm)"}; - AxisSpec ptAxis = {600, 0.0, 6.0, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec pAxis = {400, 0.0, 4.0, "#it{p} (GeV/#it{c})"}; - AxisSpec betaAxis = {200, 0.0, 2.0, "TOF_{#beta} (GeV/#it{c})"}; - AxisSpec dEdxAxis = {2000, 0.0, 200.0, "dE/dx (GeV/#it{c})"}; - AxisSpec etaAxis = {300, -1.5, 1.5, "#eta"};// 300, -1.5, 1.5 - AxisSpec nSigmaTPCAxis = {170, -8.5, 8.5, "n#sigma_{TPC}^{proton}"}; - AxisSpec nSigmaTPCAxispid = {170, -8.5, 8.5, "n#sigma_{TPC}"}; - AxisSpec nSigmaTOFAxispid = {170, -8.5, 8.5, "n#sigma_{TOF}"}; - // AxisSpec nChAxis = {2500, -0.5, 2499.5, "nCh"}; - AxisSpec centAxis = {100, 0., 100., "centrality"}; - AxisSpec subAxis = {30, 0., 30., "sample"}; - AxisSpec nchAxis = {4000, 0., 4000., "nch"}; - AxisSpec varAxis1 = {400, 0., 4., "var1"}; - AxisSpec varAxis2 = {400, 0., 4., "var2"}; - AxisSpec Chi2Axis = {100, 0., 100., "Chi2"}; - AxisSpec CrossedrowTPCAxis = {600, 0., 600., "TPC Crossed rows"}; - AxisSpec Counter = {10, 0., 10., "events"}; - - // QA Plots - histos.add("hEventCounter", "event counts", kTH1D, {Counter}); - - auto h = histos.add("tracksel", "tracksel", HistType::kTH1D, {{10, 0.5, 10.5}}); - h->GetXaxis()->SetBinLabel(1, "Tracks read"); - h->GetXaxis()->SetBinLabel(2, "Global track passed"); - h->GetXaxis()->SetBinLabel(3, "DCAxy passed"); - h->GetXaxis()->SetBinLabel(4, "DCAz passed"); - h->GetXaxis()->SetBinLabel(5, "Eta-cut passed"); - h->GetXaxis()->SetBinLabel(6, "pT-cut passed"); - h->GetXaxis()->SetBinLabel(7, "TPC crossed rows passed"); - h->GetXaxis()->SetBinLabel(8, "TPC Chai2cluster passed"); - h->GetXaxis()->SetBinLabel(9, "ITS Chai2cluster passed"); - - histos.add("hEventCounter_recMC", "event counts rec MC", kTH1D, {Counter}); - - auto h_rec = histos.add("tracksel_rec", "tracksel_rec", HistType::kTH1D, {{10, 0.5, 10.5}}); - h_rec->GetXaxis()->SetBinLabel(1, "has_mcCollision() read"); - h_rec->GetXaxis()->SetBinLabel(2, "Vertex Z > 10cm passed"); - h_rec->GetXaxis()->SetBinLabel(3, "sel 8 passed"); - h_rec->GetXaxis()->SetBinLabel(4, "kNoSameBunchPileup passed"); - h_rec->GetXaxis()->SetBinLabel(5, "kNoITSROFrameBorder passed"); - h_rec->GetXaxis()->SetBinLabel(6, "klsGoodZvtxFT0vsPV passed"); - h_rec->GetXaxis()->SetBinLabel(7, "klsVertexITSTPC passed"); - - histos.add("Data/hZvtx_before_sel", "hZvtx_before_sel", kTH1D, {vtxZAxis}); - histos.add("Data/hZvtx_after_sel", "hZvtx_after_sel", kTH1D, {vtxZAxis}); - histos.add("Data/hZvtx_after_sel8", "hZvtx_after_sel8", kTH1D, {vtxZAxis}); - histos.add("Data/hP", "hP", kTH1D, {pAxis}); - histos.add("Data/hEta", ";hEta", kTH1D, {etaAxis}); - histos.add("Data/hPt", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("Data/hNsigmaTPC", "hNsigmaTPC", kTH2D, {pAxis, nSigmaTPCAxis}); - histos.add("Data/hDCAxy", "hDCAxy", kTH1D, {dcaAxis}); - histos.add("Data/hDCAz", "hDCAz", kTH1D, {dcazAxis}); - - histos.add("Data/hPtDCAxy", "hPtDCAxy", kTH2D, {ptAxis, dcaAxis}); - histos.add("Data/hPtDCAz", "hPtDCAz", kTH2D, {ptAxis, dcazAxis}); - histos.add("Data/NSigamaTPCpion", "NSigamaTPCpion", kTH2D, {ptAxis, nSigmaTPCAxispid}); - histos.add("Data/NSigamaTPCkaon", "NSigamaTPCkaon", kTH2D, {ptAxis, nSigmaTPCAxispid}); - histos.add("Data/NSigamaTPCproton", "NSigamaTPCproton", kTH2D, {ptAxis, nSigmaTPCAxispid}); - - histos.add("Data/NSigamaTOFpion", "NSigamaTOFpion", kTH2D, {ptAxis, nSigmaTOFAxispid}); - histos.add("Data/NSigamaTOFkaon", "NSigamaTOFkaon", kTH2D, {ptAxis, nSigmaTOFAxispid}); - histos.add("Data/NSigamaTOFproton", "NSigamaTOFproton", kTH2D, {ptAxis, nSigmaTOFAxispid}); - - histos.add("Data/NSigamaTPCTOFpion", "NSigamaTPCTOFpion", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("Data/NSigamaTPCTOFkaon", "NSigamaTPCTOFkaon", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("Data/NSigamaTPCTOFproton", "NSigamaTPCTOFproton", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - - histos.add("Data/hPtPion", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("Data/hPtKaon", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("Data/hPtProton", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - - histos.add("Data/hEtaPion", ";hEta", kTH1D, {etaAxis}); - histos.add("Data/hEtaKaon", ";hEta", kTH1D, {etaAxis}); - histos.add("Data/hEtaProton", ";hEta", kTH1D, {etaAxis}); - //=====================rapidity===================================== - histos.add("Data/hyPion", ";hyPion", kTH1D, {etaAxis}); - histos.add("Data/hyKaon", ";hyKaon", kTH1D, {etaAxis}); - histos.add("Data/hyProton", ";hyProton", kTH1D, {etaAxis}); - - histos.add("Data/hPtCh", "hPtCh", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtChPion", "hPtChPion", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtChKaon", "hPtChKaon", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtChProton", "hPtChProton", kTH2D, {nchAxis, ptAxis}); - - histos.add("Data/hPtCent", "hPtCent", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hPtCentPion", "hPtCentPion", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hPtCentKaon", "hPtCentKaon", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hPtCentProton", "hPtCentProton", kTH2D, {centAxis, ptAxis}); - - histos.add("Data/hMeanPtCh", "hMeanPtCh", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hCent", "hCent", kTH2D, {nchAxis, centAxis}); - - histos.add("Data/hVar1", "hVar1", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2", "hVar2", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2meanpt", "hVar2meanpt", kTH2D, {centAxis, varAxis2}); - histos.add("Data/hVar", "hVar", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVarc", "hVarc", kTH2D, {subAxis, centAxis}); - - histos.add("Data/hVar1pi", "hVar1pi", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2pi", "hVar2pi", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVarpi", "hVarpi", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2meanptpi", "hVar2meanptpi", kTH2D, {centAxis, varAxis2}); - - histos.add("Data/hVar1k", "hVar1k", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2k", "hVar2k", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVark", "hVark", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2meanptk", "hVar2meanptk", kTH2D, {centAxis, varAxis2}); - - histos.add("Data/hVar1p", "hVar1p", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2p", "hVar2p", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVarp", "hVarp", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2meanptp", "hVar2meanptp", kTH2D, {centAxis, varAxis2}); - - //--------------------------------nch---------------------------------- - - histos.add("Data/hnch_all", ";hnch_all", kTH1D, {nchAxis}); - histos.add("Data/hnch_all_bf_cut", ";hnch_all_bf_cut", kTH1D, {nchAxis}); - histos.add("Data/hnch", ";hnch", kTH1D, {nchAxis}); - histos.add("Data/hnch_true", ";hnch_true", kTH1D, {nchAxis}); - histos.add("Data/hnch_true_pt", ";hnch_true_pt", kTH1D, {nchAxis}); - - - histos.add("Data/hVar1x_old", "hVar1x_old", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2x_old", "hVar2x_old", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVarx_old", "hVarx_old", kTH2D, {subAxis, nchAxis}); - - - histos.add("Data/hVar1x", "hVar1x", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2x", "hVar2x", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVarx", "hVarx", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2meanptx", "hVar2meanptx", kTH2D, {nchAxis, varAxis2}); - - histos.add("Data/hVar1pix", "hVar1pix", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2pix", "hVar2pix", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVarpix", "hVarpix", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2meanptpix", "hVar2meanptpix", kTH2D, {nchAxis, varAxis2}); - - histos.add("Data/hVar1kx", "hVar1kx", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2kx", "hVar2kx", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVarkx", "hVarkx", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2meanptkx", "hVar2meanptkx", kTH2D, {nchAxis, varAxis2}); - - histos.add("Data/hVar1px", "hVar1px", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2px", "hVar2px", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVarpx", "hVarpx", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2meanptpx", "hVar2meanptpx", kTH2D, {nchAxis, varAxis2}); - - histos.add("Data/ht", "ht", kTH1D, {centAxis}); - - histos.add("Data/hCentrality", "hCentrality", kTH1D, {centAxis}); - - histos.add("Data/hPEta", "hPEta", kTH2D, {pAxis, etaAxis}); - histos.add("Data/hPtEta", "hPtEta", kTH2D, {ptAxis, etaAxis}); - histos.add("Data/hPy", "hPy", kTH2D, {pAxis, etaAxis}); - histos.add("Data/hPty", "hPty", kTH2D, {ptAxis, etaAxis}); - - histos.add("Data/hPtyPion", "hPtyPion", kTH2D, {ptAxis, etaAxis}); - histos.add("Data/hPtyKaon", "hPtyKaon", kTH2D, {ptAxis, etaAxis}); - histos.add("Data/hPtyProton", "hPtyProton", kTH2D, {ptAxis, etaAxis}); - - histos.add("Data/hTOFbeta", "hTOFbeta", kTH2D, {pAxis, betaAxis}); - histos.add("Data/hdEdx", "hdEdx", kTH2D, {pAxis, dEdxAxis}); - - histos.add("Data/hTOFbeta_afterselection", "hTOFbeta_afterselection", kTH2D, {pAxis, betaAxis}); - histos.add("Data/hdEdx_afterselection", "hdEdx_afterselection", kTH2D, {pAxis, dEdxAxis}); - - histos.add("Data/hTOFbeta_afterselection1", "hTOFbeta_afterselection1", kTH2D, {pAxis, betaAxis}); - histos.add("Data/hdEdx_afterselection1", "hdEdx_afterselection1", kTH2D, {pAxis, dEdxAxis}); - - histos.add("Data/hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); - histos.add("Data/hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); - histos.add("Data/hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); - - histos.add("Data/hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); - histos.add("Data/hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {Chi2Axis}); - histos.add("Data/hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {CrossedrowTPCAxis}); - - histos.add("Data/hdEdx_rec_bf_anycut", "hdEdx_rec_bf_anycut", kTH2D, {pAxis, dEdxAxis}); - histos.add("Data/hcent_nacc", "hcent_nacc", kTH2D, {centAxis, nchAxis}); - - - histos.addClone("Data/", "Rec/"); -//rec histograms - histos.add("NSigamaTPCpion_rec", "NSigamaTPCpion_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCkaon_rec", "NSigamaTPCkaon_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCproton_rec", "NSigamaTPCproton_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); - - histos.add("NSigamaTOFpion_rec", "NSigamaTOFpion_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFkaon_rec", "NSigamaTOFkaon_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFproton_rec", "NSigamaTOFproton_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); - - - histos.add("NSigamaTPCTOFpion_rec", "NSigamaTPCTOFpion_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFkaon_rec", "NSigamaTPCTOFkaon_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFproton_rec", "NSigamaTPCTOFproton_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - - histos.add("NSigamaTPCpion_rec_bf_sel", "NSigamaTPCpion_rec_bf_sel", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCkaon_rec_bf_sel", "NSigamaTPCkaon_rec_bf_sel", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCproton_rec_bf_sel", "NSigamaTPCproton_rec_bf_sel", kTH2D, {pAxis, nSigmaTPCAxispid}); - - histos.add("NSigamaTOFpion_rec_bf_sel", "NSigamaTOFpion_rec_bf_sel", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFkaon_rec_bf_sel", "NSigamaTOFkaon_rec_bf_sel", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFproton_rec_bf_sel", "NSigamaTOFproton_rec_bf_sel", kTH2D, {pAxis, nSigmaTOFAxispid}); - - histos.add("NSigamaTPCTOFpion_rec_bf_sel", "NSigamaTPCTOFpion_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFkaon_rec_bf_sel", "NSigamaTPCTOFkaon_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFproton_rec_bf_sel", "NSigamaTPCTOFproton_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - - - histos.add("hPtyPion_rec", "hPtyPion_rec", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtyKaon_rec", "hPtyKaon_rec", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtyProton_rec", "hPtyProton_rec", kTH2D, {ptAxis, etaAxis}); - - histos.add("hPyPion_rec", "hPyPion_rec", kTH2D, {pAxis, etaAxis}); - histos.add("hPyKaon_rec", "hPyKaon_rec", kTH2D, {pAxis, etaAxis}); - histos.add("hPyProton_rec", "hPyProton_rec", kTH2D, {pAxis, etaAxis}); - - - histos.add("hTOFbeta_afterselection_rec_afterpidcut", "hTOFbeta_afterselection_rec_afterpidcut", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_afterselection_rec_afterpidcut", "hdEdx_afterselection_rec_afterpidcut", kTH2D, {pAxis, dEdxAxis}); - - histos.add("hTOFbeta_afterselection_rec_beforepidcut", "hTOFbeta_afterselection_rec_beforepidcut", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_afterselection_rec_beforepidcut", "hdEdx_afterselection_rec_beforepidcut", kTH2D, {pAxis, dEdxAxis}); - - - histos.add("heffVar1x", "heffVar1x", kTH2D, {subAxis, nchAxis}); - histos.add("heffVar2x", "heffVar2x", kTH2D, {subAxis, nchAxis}); - histos.add("heffVarx", "heffVarx", kTH2D, {subAxis, nchAxis}); - histos.add("heffVar2meanptx", "heffVar2meanptx", kTH2D, {nchAxis, varAxis2}); - - //--------------------------------nch---------------------------------- - histos.add("hnch_rec_all", ";hnch_rec_all", kTH1D, {nchAxis}); - histos.add("hnch_rec", ";hnch_rec", kTH1D, {nchAxis}); - histos.add("hnch_rec_true", ";hnch_rec_true", kTH1D, {nchAxis}); - - histos.add("hVar1x_rec_old", "hVar1x_rec_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_rec_old", "hVar2x_rec_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_rec_old", "hVarx_rec_old", kTH2D, {subAxis, nchAxis}); - - histos.add("hVar1x_rec", "hVar1x_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_rec", "hVar2x_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_rec", "hVarx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptx_rec", "hVar2meanptx_rec", kTH2D, {nchAxis, varAxis2}); - - histos.add("hVar1pix_rec", "hVar1pix_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2pix_rec", "hVar2pix_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpix_rec", "hVarpix_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpix_rec", "hVar2meanptpix_rec", kTH2D, {nchAxis, varAxis2}); - - histos.add("hVar1kx_rec", "hVar1kx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2kx_rec", "hVar2kx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarkx_rec", "hVarkx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptkx_rec", "hVar2meanptkx_rec", kTH2D, {nchAxis, varAxis2}); - - histos.add("hVar1px_rec", "hVar1px_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2px_rec", "hVar2px_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpx_rec", "hVarpx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpx_rec", "hVar2meanptpx_rec", kTH2D, {nchAxis, varAxis2}); - - histos.add("hZvtx_after_sel_rec", "hZvtx_after_sel_rec", kTH1D, {vtxZAxis}); - histos.add("hZvtx_after_sel8_rec", "hZvtx_after_sel8_rec", kTH1D, {vtxZAxis}); - - histos.add("etaHistogram_allcharge_rec", "etaHistogram_allcharge_rec", kTH1D, {etaAxis}); - - histos.add("ptHistogram_allcharge_bfptcut_rec", "ptHistogram_allcharge_bfptcut_rec", kTH1D, {ptAxis}); - - histos.add("ptHistogram_allcharge_rec", "ptHistogram_allcharge_rec", kTH1D, {ptAxis}); - histos.add("ptHistogramPionrec", "ptHistogramPionrec", kTH1D, {ptAxis}); - histos.add("ptHistogramKaonrec", "ptHistogramKaonrec", kTH1D, {ptAxis}); - histos.add("ptHistogramProtonrec", "ptHistogramProtonrec", kTH1D, {ptAxis}); - - histos.add("ptHistogramPionrec_purity", "ptHistogramPionrec_purity", kTH1D, {ptAxis}); - histos.add("ptHistogramKaonrec_purity", "ptHistogramKaonrec_purity", kTH1D, {ptAxis}); - histos.add("ptHistogramProtonrec_purity", "ptHistogramProtonrec_purity", kTH1D, {ptAxis}); - - histos.add("ptHistogramPionrec_pdg", "ptHistogramPionrec_pdg", kTH1D, {ptAxis}); - histos.add("ptHistogramKaonrec_pdg", "ptHistogramKaonrec_pdg", kTH1D, {ptAxis}); - histos.add("ptHistogramProtonrec_pdg", "ptHistogramProtonrec_pdg", kTH1D, {ptAxis}); - - histos.add("Histogram_mass2_p_rec_beforesel", "Histogram_mass2_p_rec_beforesel", kTH1D, {ptAxis}); - histos.add("Histogram_mass2_p_rec_aftersel", "Histogram_mass2_p_rec_aftersel", kTH1D, {ptAxis}); - - - //=======================MC histograms Generated ================================================ - histos.add("ptHistogram_allcharge_gen", "ptHistogram_allcharge_gen", kTH1D, {ptAxis}); - histos.add("ptHistogramPion", "ptHistogramPion", kTH1D, {ptAxis}); - histos.add("ptHistogramKaon", "ptHistogramKaon", kTH1D, {ptAxis}); - histos.add("ptHistogramProton", "ptHistogramProton", kTH1D, {ptAxis}); - - histos.add("hMC_Pt", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("MC_hZvtx_after_sel", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {vtxZAxis}); - - histos.add("hTOFbeta_gen_pion", "hTOFbeta_gen_pion", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_gen_pion", "hdEdx_gen_pion", kTH2D, {pAxis, dEdxAxis}); - - histos.add("hnch_gen_all", ";hnch_gen_all", kTH1D, {nchAxis}); - histos.add("hnch_gen", ";hnch_gen", kTH1D, {nchAxis}); - histos.add("hnch_gen_true", ";hnch_gen_true", kTH1D, {nchAxis}); - - histos.add("hnch_gen_eta", ";hnch_gen_eta", kTH1D, {etaAxis}); - - - histos.add("hnch1", ";hnch1", kTH1D, {nchAxis}); - histos.add("hnch2", ";hnch2", kTH1D, {nchAxis}); - histos.add("hnch3", ";hnch3", kTH1D, {nchAxis}); - histos.add("hnch_pi", ";hnch_pi", kTH1D, {nchAxis}); - histos.add("hnch_ka", ";hnch_ka", kTH1D, {nchAxis}); - histos.add("hnch_pr", ";hnch_pr", kTH1D, {nchAxis}); - - - - histos.add("hVar1x_gen_old", "hVar1x_gen_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_gen_old", "hVar2x_gen_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_gen_old", "hVarx_gen_old", kTH2D, {subAxis, nchAxis}); - - - histos.add("hVar1x_gen", "hVar1x_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_gen", "hVar2x_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_gen", "hVarx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptx_gen", "hVar2meanptx_gen", kTH2D, {nchAxis, varAxis2}); - - histos.add("hVar1pix_gen", "hVar1pix_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2pix_gen", "hVar2pix_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpix_gen", "hVarpix_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpix_gen", "hVar2meanptpix_gen", kTH2D, {nchAxis, varAxis2}); - - histos.add("hVar1kx_gen", "hVar1kx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2kx_gen", "hVar2kx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVarkx_gen", "hVarkx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptkx_gen", "hVar2meanptkx_gen", kTH2D, {nchAxis, varAxis2}); - - histos.add("hVar1px_gen", "hVar1px_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2px_gen", "hVar2px_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpx_gen", "hVarpx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpx_gen", "hVar2meanptpx_gen", kTH2D, {nchAxis, varAxis2}); - - //========================MC Histograms Reconstructed================================================= - - - histos.add("hcent_nacc_rec", "hcent_nacc_rec", kTH2D, {centAxis, nchAxis}); - histos.add("hcent_nacc_gen", "hcent_nacc_gen", kTH2D, {centAxis, nchAxis}); - histos.add("hGenCentrality", "hGenCentrality", kTH1D, {centAxis}); - - histos.add("hVtxZ_before_gen", "", kTH1F, {vtxZAxis}); - histos.add("hVtxZ_after_gen", "", kTH1F, {vtxZAxis}); - histos.add("hEta_gen", "", kTH1F, {etaAxis}); - histos.add("hEta_rec", "", kTH1F, {etaAxis}); - histos.add("hPt_gen", "", kTH1F, {ptAxis}); - histos.add("hPt_rec", "", kTH1F, {ptAxis}); - - - - } - - - // Configurables - Configurable cVtxZcut{"cVtx", 10.f, "Vertex Z"}; - Configurable cEtacut{"cEta", 0.8, "Eta cut"}; - Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; - Configurable cPtmaxcut{"cPtmaxcut", 2.0, "Pt max cut"}; - Configurable cDcaXYcut{"cDcaXYcut", 0.12, "DCA XY cut"}; - Configurable cDcaZcut{"cDcaZcut", 0.3, "DCA Z cut"}; - Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; - Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; - Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; - Configurable cITSchicut{"cITSchi2clustercut", 70, "ITS chi2 cluster cut"}; - Configurable cTPCchicut{"cTPCchi2clustercut", 70, "TPC chi2 cluster cut"}; - - - // Event selections - Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; - Configurable cTFBorder{"cTFBorder", true, "Timeframe Border Selection"}; - Configurable cNoItsROBorder{"cNoItsROBorder", true, "No ITSRO Border Cut"}; - Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; - Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", true, "z-vtx time diff selection"}; - Configurable cIsGoodITSLayers{"cIsGoodITSLayers", true, "Good ITS Layers All"}; - Configurable cItslayerall{"cItslayerall", true, "dead staves of ITS removed"}; - Configurable cvtxtofmatched{"cvtxtofmatched", true, "TOF vertex matched"}; - Configurable cfgRejEl{"cfgRejEl", true, "Rejected electrons"}; - - - //PID selection configurables - Configurable cPionPmincut{"cPionPmincut", 0.2, "pion min cut of pion"}; - Configurable cKaonPmincut{"cKaonPmincut", 0.2, "kaon min cut of kaon"}; - Configurable cProtonPmincut{"cProtonPmincut", 0.2, "proton min cut of proton"}; - Configurable cPionPmaxcut{"cPionPmaxcut", 2.0, "pion min cut of pion"}; - Configurable cKaonPmaxcut{"cKaonPmaxcut", 2.0, "kaon min cut of kaon"}; - Configurable cProtonPmaxcut{"cProtonPmaxcut", 2.0, "proton min cut of proton"}; - Configurable cPionPthcut{"cPionPthcut", 0.65, "pion threshold cut of pion"}; - Configurable cKaonPthcut{"cKaonPthcut", 0.65, "kaon threshold cut of kaon"}; - Configurable cProtonPthcut{"cProtonPthcut", 1.0, "proton threshold cut of proton"}; - Configurable cNSigCut2{"cNSigCut2", 2.0, "nSigma cut (2)"}; - Configurable cNSigCut3{"cNSigCut3", 3.0, "nSigma cut (3)"}; - - - template < typename C> - bool selCollision(C const& coll) - { - - if (std::abs(coll.posZ()) > cVtxZcut) {return false;} //Reject the collisions with large vertex-z - histos.fill(HIST("hEventCounter"), 2.); - -// cent = coll.centFT0M(); //centrality for run3 - if (cSel8Trig && !coll.sel8()) {return false;} //require min bias trigger - histos.fill(HIST("hEventCounter"), 3.); - - if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) {return false;} - if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) {return false;} - histos.fill(HIST("tracksel_rec"), 4); - - if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) {return false;} - histos.fill(HIST("tracksel_rec"), 5); - - if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) {return false;} - histos.fill(HIST("tracksel_rec"), 6); - - if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) {return false;} - histos.fill(HIST("tracksel_rec"), 7); - -// if (cItslayerall && !coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)) {return false;} - histos.fill(HIST("tracksel_rec"), 8); - - if (cvtxtofmatched && !coll.selection_bit(aod::evsel::kIsVertexTOFmatched)) {return false;} - histos.fill(HIST("tracksel_rec"), 9); - - - return true; //if all checks pass, accept the collision - - } - - - - template - bool selTrack(T const& track) - { - - if (!track.isGlobalTrack()) {return false;} //accept only global tracks - histos.fill(HIST("tracksel"), 2); - -// if (std::fabs(track.dcaXY()) > cDcaXYcut) {return false;} - histos.fill(HIST("tracksel"), 3); - -// if (std::fabs(track.dcaZ()) > cDcaZcut) {return false;} - histos.fill(HIST("tracksel"), 4); - - if (std::fabs(track.eta()) >= cEtacut) {return false;} - histos.fill(HIST("tracksel"), 5); - - if (track.pt() < cPtmincut ) {return false;} - if (track.pt() > cPtmaxcut) {return false;} - histos.fill(HIST("tracksel"), 6); - -// if (track.tpcNClsCrossedRows() < cTPCcrosscut) {return false;} - histos.fill(HIST("tracksel"), 7); - -// if (track.itsChi2NCl() > cITSchicut) {return false;} - histos.fill(HIST("tracksel"), 8); - -// if (track.tpcChi2NCl() > cTPCchicut) {return false;} - histos.fill(HIST("tracksel"), 9); - - if (track.sign() == 0) return false; - - return true; //if all checks pass, accept the collision - } - - - template - bool rej_El(T const& track) - { - if ( track.tpcNSigmaEl() > -3. && track.tpcNSigmaEl() < 5. && std::fabs(track.tpcNSigmaPi()) > cNSigCut3 && std::fabs(track.tpcNSigmaKa()) > cNSigCut3 && std::fabs(track.tpcNSigmaPr()) > cNSigCut3) { return true; } - return false; - } - - - - - template - bool sel_proton(T const& track) - { - - //! if pt < threshold (For tracks without TOF information) - if (track.p() > cProtonPmincut && track.p() <= cProtonPthcut) { - if (track.hasTPC() && std::fabs(track.tpcNSigmaPr()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2) { return true; } - } - - //! if pt < threshold (For tracks with TOF information) - if (track.p() > cProtonPmincut && track.p() <= cProtonPthcut) { - if (track.hasTOF() && std::fabs(track.tpcNSigmaPr()) < cNSigCut2 && std::fabs(track.tofNSigmaPr()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2) { return true; } - } - - - //! if pt > threshold (For tracks with TOF information) - if (track.p() > cProtonPthcut && track.p() <= cProtonPmaxcut) { - if ( track.hasTPC() && track.hasTOF() && std::fabs(track.tpcNSigmaPr()) < cNSigCut2 && std::fabs(track.tofNSigmaPr()) < cNSigCut2 && std::hypot(track.tofNSigmaPi(), track.tpcNSigmaPi()) > cNSigCut2 && std::hypot(track.tofNSigmaKa(), track.tpcNSigmaKa()) > cNSigCut2 ) { return true; } - } - - return false; - - } - - template - bool sel_kaon(T const& track) - { - - //! if pt < threshold (For tracks without TOF information) - if (track.p() > cKaonPmincut && track.p() <= cKaonPthcut) { - if (track.hasTPC() && std::fabs(track.tpcNSigmaKa()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } - } - - //! if pt < threshold (For tracks with TOF information) - if (track.p() > cKaonPmincut && track.p() <= cKaonPthcut) { - if (track.hasTOF() && std::fabs(track.tpcNSigmaKa()) < cNSigCut2 && std::fabs(track.tofNSigmaKa()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } - } - - - //! if pt > threshold (For tracks with TOF information) - if (track.p() > cKaonPthcut && track.p() <= cKaonPmaxcut) { - if ( track.hasTPC() && track.hasTOF() && std::fabs(track.tpcNSigmaKa()) < cNSigCut2 && std::fabs(track.tofNSigmaKa()) < cNSigCut2 && std::hypot(track.tofNSigmaPi(), track.tpcNSigmaPi()) > cNSigCut2 && std::hypot(track.tofNSigmaPr(), track.tpcNSigmaPr()) > cNSigCut2 ) { return true; } - } - - return false; - - } - - template - bool sel_pion(T const& track) - { - - //! if pt < threshold (For tracks without TOF information) - if (track.p() > cPionPmincut && track.p() <= cPionPthcut) { - if (track.hasTPC() && std::fabs(track.tpcNSigmaPi()) < cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } - } - - //! if pt < threshold (For tracks with TOF information) - if (track.p() > cPionPmincut && track.p() <= cPionPthcut) { - if (track.hasTOF() && std::fabs(track.tpcNSigmaPi()) < cNSigCut2 && std::fabs(track.tofNSigmaPi()) < cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } - } - - //! if pt > threshold (For tracks with TOF information) - if (track.p() > cPionPthcut && track.p() <= cPionPmaxcut) { - if ( track.hasTPC() && track.hasTOF() && std::fabs(track.tpcNSigmaPi()) < cNSigCut2 && std::fabs(track.tofNSigmaPi()) < cNSigCut2 && std::hypot(track.tofNSigmaKa(), track.tpcNSigmaKa()) > cNSigCut2 && std::hypot(track.tofNSigmaPr(), track.tpcNSigmaPr()) > cNSigCut2 ) { return true; } - } - - return false; - - } - - - //++++++++++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++// - // // - // // - // // - //++++++++++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++// - - void process(aod::MyCollision const& coll, aod::MyTracks const& inputTracks) - { - histos.fill(HIST("hEventCounter"), 1.); - histos.fill(HIST("Data/hZvtx_before_sel"), coll.posZ()); - - if (!selCollision(coll)) return; - { histos.fill(HIST("Data/hZvtx_after_sel8"), coll.posZ()); - } - - const auto cent = coll.centFT0C(); - histos.fill(HIST("Data/hCentrality"), cent); - - - double nCh = 0., nChpi = 0., nChk = 0., nChp = 0., nCh_all = 0., nCh_true = 0., nCh_all_bfcut = 0., nCh_eta = 0., nCh_pt = 0.; - double Q1 = 0., Q2 = 0., Q1_old = 0., Q2_old = 0.; - double Q1pi = 0., Q2pi = 0.; - double Q1k = 0., Q2k = 0.; - double Q1p = 0., Q2p = 0.; - double var1 = 0., var2 = 0., twopar_allcharge = 0., var1_old = 0., var2_old = 0.; - double var1pi = 0., var2pi = 0.; - double var1k = 0., var2k = 0.; - double var1p = 0., var2p = 0.; - // double sum_pt_weight = 0., sum_weight = 0., sum_pt_pt_weight = 0.; - - int sample = histos.get(HIST("Data/hZvtx_after_sel8"))->GetEntries(); - sample = sample % 30; //subsample error estimation - - // Perfroming the track selection========================================== - for (auto track : inputTracks) { - - nCh_all_bfcut += 1.; - histos.fill(HIST("Data/hnch_all_bf_cut"), nCh_all_bfcut); - - histos.fill(HIST("tracksel"), 1); - histos.fill(HIST("Data/hTPCchi2perCluster_before"), track.tpcChi2NCl()); - histos.fill(HIST("Data/hITSchi2perCluster_before"), track.itsChi2NCl()); - histos.fill(HIST("Data/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); - - - if (std::fabs(track.eta()) <= cEtacut ) - {nCh_eta++; - histos.fill(HIST("Data/hnch_true"), nCh_eta); - } - - if (track.pt() >= cPtmincut && track.pt() <= cPtmaxcut){ - nCh_pt += 1.; - histos.fill(HIST("Data/hnch_true_pt"), nCh_pt);} - - - if(track.sign() == 0) continue; - if (!selTrack(track)) continue; - - nCh_all += 1.; - histos.fill(HIST("Data/hnch_all"), nCh_all); - - - histos.fill(HIST("Data/hDCAxy"), track.dcaXY()); - histos.fill(HIST("Data/hDCAz"), track.dcaZ()); - histos.fill(HIST("Data/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); - histos.fill(HIST("Data/hTPCchi2perCluster_after"), track.tpcChi2NCl()); - histos.fill(HIST("Data/hITSchi2perCluster_after"), track.itsChi2NCl()); - histos.fill(HIST("Data/hP"), track.p()); - histos.fill(HIST("Data/hPt"), track.pt()); - histos.fill(HIST("Data/hEta"), track.eta()); - histos.fill(HIST("Data/hPtDCAxy"), track.pt(), track.dcaXY()); - histos.fill(HIST("Data/hPtDCAz"), track.pt(), track.dcaZ()); - histos.fill(HIST("Data/hPtEta"), track.pt(), track.eta()); - histos.fill(HIST("Data/hPEta"), track.p(), track.eta()); - histos.fill(HIST("Data/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); - - - if (track.pt() >= 0.15 || track.pt() <= 2.0) //do not change this (it is for different pt work) - {nCh += 1.; - Q1_old += track.pt(); - Q2_old += (track.pt() * track.pt()); - histos.fill(HIST("Data/hnch"), nCh); - - } - // histos.fill(HIST("hnch"), nCh); - - Q1 += track.pt(); - Q2 += (track.pt() * track.pt()); - - - - // only TPC tracks: Pion, Kaon, Proton - if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < 3.) - histos.fill(HIST("Data/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); - if (track.hasTPC() && std::abs(track.tpcNSigmaKa()) < 3.) - histos.fill(HIST("Data/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); - if (track.hasTPC() && std::abs(track.tpcNSigmaPr()) < 3.) - histos.fill(HIST("Data/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); - - // only TOF tracks: Pion, Kaon, Proton - if (track.hasTOF() && std::abs(track.tofNSigmaPi()) < 3.) - histos.fill(HIST("Data/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); - if (track.hasTOF() && std::abs(track.tofNSigmaKa()) < 3.) - histos.fill(HIST("Data/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); - if (track.hasTOF() && std::abs(track.tofNSigmaPr()) < 3.) - histos.fill(HIST("Data/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); - - if (track.hasTPC()) histos.fill(HIST("Data/hdEdx"), track.p(), track.tpcSignal()); - if (track.hasTOF()) histos.fill(HIST("Data/hTOFbeta"), track.p(), track.beta()); - - //===================================pion============================================================== - // only TPC+TOF tracks: Pion, Kaon, Proton - if ((track.hasTPC() && std::abs(track.tpcNSigmaPi()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaPi()) < 3.)) { - histos.fill(HIST("Data/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - - histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); - } - - - if(sel_pion(track)){ - histos.fill(HIST("Data/hPtPion"), track.pt()); - histos.fill(HIST("Data/hEtaPion"), track.eta()); - histos.fill(HIST("Data/hyPion"), track.rapidity(massPi)); - histos.fill(HIST("Data/hPtyPion"), track.pt(), track.rapidity(massPi)); - - nChpi += 1.; - Q1pi += track.pt(); - Q2pi += (track.pt() * track.pt()); - - if (track.beta() > 1) continue; - - histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); - } - - - //===========================kaon=============================================================== - - if ((track.hasTPC() && std::abs(track.tpcNSigmaKa()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaKa()) < 3.)) { - histos.fill(HIST("Data/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); - } - - if(sel_kaon(track)){ - - - histos.fill(HIST("Data/hPtKaon"), track.pt()); - histos.fill(HIST("Data/hEtaKaon"), track.eta()); - histos.fill(HIST("Data/hyKaon"), track.rapidity(massKa)); - histos.fill(HIST("Data/hPtyKaon"), track.pt(), track.rapidity(massKa)); - - nChk += 1.; - Q1k += track.pt(); - Q2k += (track.pt() * track.pt()); - - if (track.beta() > 1) - continue; - - histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); - } - - - //============================proton=========================================================== - - if ((track.hasTPC() && std::abs(track.tpcNSigmaPr()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaPr()) < 3.)) { - histos.fill(HIST("Data/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - - histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); - } - - if(sel_proton(track)){ - histos.fill(HIST("Data/hPtProton"), track.pt()); - histos.fill(HIST("Data/hEtaProton"), track.eta()); - histos.fill(HIST("Data/hyProton"), track.rapidity(massPr)); - histos.fill(HIST("Data/hPtyProton"), track.pt(), track.rapidity(massPr)); - - nChp += 1.; - Q1p += track.pt(); - Q2p += (track.pt() * track.pt()); - - if (track.beta() > 1) - continue; - - histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); - } - - - } - // Track loop ends! - - histos.fill(HIST("Data/hcent_nacc"), cent, nCh_all); - - - if (nCh >= 2.0) - { - var1_old = (Q1_old * Q1_old - Q2_old) / (nCh * (nCh - 1)); - var2_old = (Q1_old / nCh); - } - - - - if (nCh_all < 2.0) return; - var1 = (Q1 * Q1 - Q2) / (nCh_all * (nCh_all - 1)); - var2 = (Q1 / nCh_all); - - - //------------------ all charges------------------------------------- - - histos.fill(HIST("Data/hVar1"), sample, cent, var1); - histos.fill(HIST("Data/hVar2"), sample, cent, var2); - histos.fill(HIST("Data/hVarc"), sample, cent); - histos.fill(HIST("Data/hVar2meanpt"), cent, var2); - - twopar_allcharge = (var1 - var2); - histos.fill(HIST("Data/hVar"), nCh_all, twopar_allcharge); - - //---------------------- pions ---------------------------------------- - - if (nChpi >= 2.0) { - var1pi = (Q1pi * Q1pi - Q2pi) / (nChpi * (nChpi - 1)); - var2pi = (Q1pi / nChpi); - } - - //----------------------- kaons --------------------------------------- - if (nChk >= 2.0) { - var1k = (Q1k * Q1k - Q2k) / (nChk * (nChk - 1)); - var2k = (Q1k / nChk); - } - - //---------------------------- protons ---------------------------------- - if (nChp >= 2.0) { - var1p = (Q1p * Q1p - Q2p) / (nChp * (nChp - 1)); - var2p = (Q1p / nChp); - } - - //========================centrality========================================== - - histos.fill(HIST("Data/hVar1pi"), sample, cent, var1pi); - histos.fill(HIST("Data/hVar2pi"), sample, cent, var2pi); - histos.fill(HIST("Data/hVar2meanptpi"), cent, var2pi); - - histos.fill(HIST("Data/hVar1k"), sample, cent, var1k); - histos.fill(HIST("Data/hVar2k"), sample, cent, var2k); - histos.fill(HIST("Data/hVar2meanptk"), cent, var2k); - - histos.fill(HIST("Data/hVar1p"), sample, cent, var1p); - histos.fill(HIST("Data/hVar2p"), sample, cent, var2p); - histos.fill(HIST("Data/hVar2meanptp"), cent, var2p); - - //-----------------------nch------------------------------------- - - - histos.fill(HIST("Data/hVar1x_old"), sample, nCh_all, var1_old); - histos.fill(HIST("Data/hVar2x_old"), sample, nCh_all, var2_old); - histos.fill(HIST("Data/hVarx_old"), sample, nCh_all); - - histos.fill(HIST("Data/hVar1x"), sample, nCh_all, var1); - histos.fill(HIST("Data/hVar2x"), sample, nCh_all, var2); - histos.fill(HIST("Data/hVarx"), sample, nCh_all); - histos.fill(HIST("Data/hVar2meanptx"), nCh_all, var2); - - histos.fill(HIST("Data/hVar1pix"), sample, nCh_all, var1pi); - histos.fill(HIST("Data/hVar2pix"), sample, nCh_all, var2pi); - histos.fill(HIST("Data/hVarpix"), sample, nChpi); - histos.fill(HIST("Data/hVar2meanptpix"), nCh_all, var2pi); - - histos.fill(HIST("Data/hVar1kx"), sample, nCh_all, var1k); - histos.fill(HIST("Data/hVar2kx"), sample, nCh_all, var2k); - histos.fill(HIST("Data/hVarkx"), sample, nChk); - histos.fill(HIST("Data/hVar2meanptkx"), nCh_all, var2k); - - histos.fill(HIST("Data/hVar1px"), sample, nCh_all, var1p); - histos.fill(HIST("Data/hVar2px"), sample, nCh_all, var2p); - histos.fill(HIST("Data/hVarpx"), sample, nChp); - histos.fill(HIST("Data/hVar2meanptpx"), nCh_all, var2p); - - - - } // event loop ends! - - PROCESS_SWITCH(IdentifiedMeanPtFluctuations, process, "process real data information", false); - - //++++++++++++++++++++++++++++++++++++MC Reconstructed +++++++++++++++++++++++++++++++++++++++++++++++++++++// - // // - // // - // // - //++++++++++++++++++++++++++++++++++++MC Reconstructed +++++++++++++++++++++++++++++++++++++++++++++++++++++// - -SliceCache cache; -Preslice mcTrack = o2::aod::mcparticle::mcCollisionId; - - void processMcReco (aod::MyMCRecoCollision const& coll, aod::MyMCRecoTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) - { - - if (!coll.has_mcCollision()) { return; } - - histos.fill(HIST("Rec/hZvtx_before_sel"), coll.posZ()); - histos.fill(HIST("hVtxZ_before_gen"), coll.mcCollision().posZ()); - - if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return ; } - if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { return ; } - if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { return ; } - if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { return ; } - if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { return ; } - if (cvtxtofmatched && !coll.selection_bit(aod::evsel::kIsVertexTOFmatched)) { return ; } - - if (std::abs(coll.posZ()) > cVtxZcut) { - return; - } - - if (!coll.sel8()) { return;} - float cent = coll.centFT0C(); - histos.fill(HIST("Rec/hZvtx_after_sel8"), coll.posZ()); - - - double nCh = 0., nChpi = 0., nChk = 0., nChp = 0., nCh_all = 0., nCh_all_bfcut = 0., nCh_eta = 0., nCh_pt = 0.; - double Q1 = 0., Q2 = 0., Q1_old = 0., Q2_old = 0.; - double Q1pi = 0., Q2pi = 0., Q1k = 0., Q2k = 0., Q1p = 0., Q2p = 0.; - double var1 = 0., var2 = 0., twopar_allcharge = 0., var1_old = 0., var2_old = 0.; - double var1pi = 0., var2pi = 0., var1k = 0., var2k = 0., var1p = 0., var2p = 0.; - double sum_pt_weight = 0., sum_weight = 0., sum_pt_pt_weight = 0., var1_eff = 0., var2_eff = 0.; - - - int sample = histos.get(HIST("Rec/hZvtx_after_sel8"))->GetEntries(); - sample = sample % 30; - - - - for (auto track : inputTracks) { - - nCh_all_bfcut += 1.; - histos.fill(HIST("Rec/hnch_all_bf_cut"), nCh_all_bfcut); - - // histos.fill(HIST("Rec/tracksel"), 1); - histos.fill(HIST("Rec/hTPCchi2perCluster_before"), track.tpcChi2NCl()); - histos.fill(HIST("Rec/hITSchi2perCluster_before"), track.itsChi2NCl()); - histos.fill(HIST("Rec/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); - - - if (std::fabs(track.eta()) <= cEtacut ) - { nCh_eta++; - histos.fill(HIST("Rec/hnch_true"), nCh_eta); - } - - - if (track.pt() >= cPtmincut && track.pt() <= cPtmaxcut) - { nCh_pt += 1.; - histos.fill(HIST("Rec/hnch_true_pt"), nCh_pt); - } - - - if (!track.isGlobalTrack()) continue; - if (std::fabs(track.eta()) > cEtacut) continue; - if ((track.pt() <= cPtmincut) || (track.pt() >= cPtmaxcut)) continue; - if(track.sign() == 0) continue; - // if (std::fabs(track.y()) > 0.5) continue; - histos.fill(HIST("hPt_rec"), track.pt()); - histos.fill(HIST("hEta_rec"), track.eta()); - - - auto mcParticle = track.mcParticle(); - - nCh_all += 1.; - histos.fill(HIST("Rec/hnch_all"), nCh_all); - histos.fill(HIST("ptHistogram_allcharge_rec"), track.pt()); - - - histos.fill(HIST("Rec/hDCAxy"), track.dcaXY()); - histos.fill(HIST("Rec/hDCAz"), track.dcaZ()); - histos.fill(HIST("Rec/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); - histos.fill(HIST("Rec/hTPCchi2perCluster_after"), track.tpcChi2NCl()); - histos.fill(HIST("Rec/hITSchi2perCluster_after"), track.itsChi2NCl()); - histos.fill(HIST("Rec/hP"), track.p()); - histos.fill(HIST("Rec/hPt"), track.pt()); - histos.fill(HIST("Rec/hEta"), track.eta()); - histos.fill(HIST("Rec/hPtDCAxy"), track.pt(), track.dcaXY()); - histos.fill(HIST("Rec/hPtDCAz"), track.pt(), track.dcaZ()); - histos.fill(HIST("Rec/hPtEta"), track.pt(), track.eta()); - histos.fill(HIST("Rec/hPEta"), track.p(), track.eta()); - histos.fill(HIST("Rec/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); - - - if (track.pt() >= 0.15 || track.pt() <= 2.0) //do not change this (it is for different pt work) - {nCh += 1.; - Q1_old += track.pt(); - Q2_old += (track.pt() * track.pt()); - histos.fill(HIST("Rec/hnch"), nCh); - } - - Q1 += track.pt(); - Q2 += (track.pt() * track.pt()); - - - if (std::abs(mcParticle.pdgCode()) == 211) histos.fill(HIST("ptHistogramPionrec_pdg"), track.pt()); - if (std::abs(mcParticle.pdgCode()) == 321) histos.fill(HIST("ptHistogramKaonrec_pdg"),track.pt()); - if (std::abs(mcParticle.pdgCode()) == 2212) histos.fill(HIST("ptHistogramProtonrec_pdg"), track.pt()); - - if (cfgRejEl == false && rej_El(track)) { return; } - - // only TPC tracks: Pion, Kaon, Proton - if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < 3.) - histos.fill(HIST("Rec/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); - if (track.hasTPC() && std::abs(track.tpcNSigmaKa()) < 3.) - histos.fill(HIST("Rec/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); - if (track.hasTPC() && std::abs(track.tpcNSigmaPr()) < 3.) - histos.fill(HIST("Rec/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); - - - - // only TOF tracks: Pion, Kaon, Proton - if (track.hasTOF() && std::abs(track.tofNSigmaPi()) < 3.) - histos.fill(HIST("Rec/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); - if (track.hasTOF() && std::abs(track.tofNSigmaKa()) < 3.) - histos.fill(HIST("Rec/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); - if (track.hasTOF() && std::abs(track.tofNSigmaPr()) < 3.) - histos.fill(HIST("Rec/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); - - if (track.hasTPC()) histos.fill(HIST("Rec/hdEdx"), track.p(), track.tpcSignal()); - if (track.hasTOF()) histos.fill(HIST("Rec/hTOFbeta"), track.p(), track.beta()); - - - if (track.hasTPC()) histos.fill(HIST("hdEdx_afterselection_rec_beforepidcut"), track.p(), track.tpcSignal()); - if (track.hasTOF()) histos.fill(HIST("hTOFbeta_afterselection_rec_beforepidcut"), track.p(), track.beta()); - - - //===================================pion============================================================== - if ((track.hasTPC() && std::abs(track.tpcNSigmaPi()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaPi()) < 3.)) { - histos.fill(HIST("Rec/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - - histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); - } - - - - if(sel_pion(track)) - { - if (std::fabs(track.y()) > 0.5) continue; - - if (track.beta() > 1) continue; - histos.fill(HIST("ptHistogramPionrec"), track.pt()); - - histos.fill(HIST("Rec/hPtPion"), track.pt()); - histos.fill(HIST("Rec/hEtaPion"), track.eta()); - histos.fill(HIST("Rec/hyPion"), track.rapidity(massPi)); - histos.fill(HIST("Rec/hPtyPion"), track.pt(), track.rapidity(massPi)); - - histos.fill(HIST("NSigamaTPCpion_rec"), track.p(), track.tpcNSigmaPi()); - histos.fill(HIST("NSigamaTOFpion_rec"), track.p(), track.tofNSigmaPi()); - histos.fill(HIST("NSigamaTPCTOFpion_rec"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - - histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); - - if (std::abs(track.mcParticle().pdgCode()) == 211) - { histos.fill(HIST("ptHistogramPionrec_purity"), track.pt()); } - - nChpi += 1.; - Q1pi += track.pt(); - Q2pi += (track.pt() * track.pt()); - - histos.fill(HIST("hPyPion_rec"), track.p(), track.rapidity(massPi)); - histos.fill(HIST("hPtyPion_rec"), track.pt(), track.rapidity(massPi)); - - - } - -//===========================kaon=============================================================== - - if ((track.hasTPC() && std::abs(track.tpcNSigmaKa()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaKa()) < 3.)) { - histos.fill(HIST("Rec/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); - } - - if(sel_kaon(track)) - { - if (std::fabs(track.y()) > 0.5) continue; - - if (track.beta() > 1) continue; - histos.fill(HIST("ptHistogramKaonrec"), track.pt()); - - histos.fill(HIST("Rec/hPtKaon"), track.pt()); - histos.fill(HIST("Rec/hEtaKaon"), track.eta()); - histos.fill(HIST("Rec/hyKaon"), track.rapidity(massKa)); - histos.fill(HIST("Rec/hPtyKaon"), track.pt(), track.rapidity(massKa)); - - histos.fill(HIST("NSigamaTPCkaon_rec"), track.p(), track.tpcNSigmaKa()); - histos.fill(HIST("NSigamaTOFkaon_rec"), track.p(), track.tofNSigmaKa()); - histos.fill(HIST("NSigamaTPCTOFkaon_rec"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - - histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); - - if (std::abs(track.mcParticle().pdgCode()) == 321) - { histos.fill(HIST("ptHistogramKaonrec_purity"), track.pt()); } - - nChk += 1.; - Q1k += track.pt(); - Q2k += (track.pt() * track.pt()); - - histos.fill(HIST("hPyKaon_rec"), track.p(), track.rapidity(massKa)); - histos.fill(HIST("hPtyKaon_rec"), track.pt(), track.rapidity(massKa)); - } - - //============================proton=========================================================== - - - if ((track.hasTPC() && std::abs(track.tpcNSigmaPr()) < 3.) && (track.hasTOF() && std::abs(track.tofNSigmaPr()) < 3.)) { - histos.fill(HIST("Rec/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - - histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); - } - - if(sel_proton(track)) - { - if (std::fabs(track.y()) > 0.5) continue; - - if (track.beta() > 1) continue; - histos.fill(HIST("ptHistogramProtonrec"), track.pt()); - - histos.fill(HIST("Rec/hPtProton"), track.pt()); - histos.fill(HIST("Rec/hEtaProton"), track.eta()); - histos.fill(HIST("Rec/hyProton"), track.rapidity(massPr)); - histos.fill(HIST("Rec/hPtyProton"), track.pt(), track.rapidity(massPr)); - - histos.fill(HIST("NSigamaTPCproton_rec"), track.p(), track.tpcNSigmaPr()); - histos.fill(HIST("NSigamaTOFproton_rec"), track.p(), track.tofNSigmaPr()); - histos.fill(HIST("NSigamaTPCTOFproton_rec"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - - histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); - - if (std::abs(track.mcParticle().pdgCode()) == 2212) - { histos.fill(HIST("ptHistogramProtonrec_purity"), track.pt()); } - - nChp += 1.; - Q1p += track.pt(); - Q2p += (track.pt() * track.pt()); - - histos.fill(HIST("hPyProton_rec"), track.p(), track.rapidity(massPr)); - histos.fill(HIST("hPtyProton_rec"), track.pt(), track.rapidity(massPr)); - } - - - }//loop over tracks - histos.fill(HIST("Rec/hcent_nacc"), cent, nCh_all); - - if (nCh >= 2.0) - { - var1_old = (Q1_old * Q1_old - Q2_old) / (nCh * (nCh - 1)); - var2_old = (Q1_old / nCh); - } - - - - if (nCh_all < 2.0) return; - var1 = (Q1 * Q1 - Q2) / (nCh_all * (nCh_all - 1)); - var2 = (Q1 / nCh_all); - - - - histos.fill(HIST("Rec/hVar1"), sample, cent, var1); - histos.fill(HIST("Rec/hVar2"), sample, cent, var2); - histos.fill(HIST("Rec/hVarc"), sample, cent); - histos.fill(HIST("Rec/hVar2meanpt"), cent, var2); - - twopar_allcharge = (var1 - var2); - histos.fill(HIST("Rec/hVar"), nCh_all, twopar_allcharge); - - //---------------------- pions ---------------------------------------- - - if (nChpi >= 2.0) { - var1pi = (Q1pi * Q1pi - Q2pi) / (nChpi * (nChpi - 1)); - var2pi = (Q1pi / nChpi); - } - - //----------------------- kaons --------------------------------------- - if (nChk >= 2.0) { - var1k = (Q1k * Q1k - Q2k) / (nChk * (nChk - 1)); - var2k = (Q1k / nChk); - } - - //---------------------------- protons ---------------------------------- - if (nChp >= 2.0) { - var1p = (Q1p * Q1p - Q2p) / (nChp * (nChp - 1)); - var2p = (Q1p / nChp); - } - //========================centrality========================================== - - histos.fill(HIST("Rec/hVar1pi"), sample, cent, var1pi); - histos.fill(HIST("Rec/hVar2pi"), sample, cent, var2pi); - histos.fill(HIST("Rec/hVar2meanptpi"), cent, var2pi); - - histos.fill(HIST("Rec/hVar1k"), sample, cent, var1k); - histos.fill(HIST("Rec/hVar2k"), sample, cent, var2k); - histos.fill(HIST("Rec/hVar2meanptk"), cent, var2k); - - histos.fill(HIST("Rec/hVar1p"), sample, cent, var1p); - histos.fill(HIST("Rec/hVar2p"), sample, cent, var2p); - histos.fill(HIST("Rec/hVar2meanptp"), cent, var2p); - - //-----------------------nch------------------------------------- - - - histos.fill(HIST("Rec/hVar1x"), sample, nCh_all, var1); - histos.fill(HIST("Rec/hVar2x"), sample, nCh_all, var2); - histos.fill(HIST("Rec/hVarx"), sample, nCh_all); - histos.fill(HIST("Rec/hVar2meanptx"), nCh_all, var2); - - histos.fill(HIST("Rec/hVar1pix"), sample, nCh_all, var1pi); - histos.fill(HIST("Rec/hVar2pix"), sample, nCh_all, var2pi); - histos.fill(HIST("Rec/hVarpix"), sample, nChpi); - histos.fill(HIST("Rec/hVar2meanptpix"), nCh_all, var2pi); - - histos.fill(HIST("Rec/hVar1kx"), sample, nCh_all, var1k); - histos.fill(HIST("Rec/hVar2kx"), sample, nCh_all, var2k); - histos.fill(HIST("Rec/hVarkx"), sample, nChk); - histos.fill(HIST("Rec/hVar2meanptkx"), nCh_all, var2k); - - histos.fill(HIST("Rec/hVar1px"), sample, nCh_all, var1p); - histos.fill(HIST("Rec/hVar2px"), sample, nCh_all, var2p); - histos.fill(HIST("Rec/hVarpx"), sample, nChp); - histos.fill(HIST("Rec/hVar2meanptpx"), nCh_all, var2p); - - -//================= generated levels============================== - const auto& mccolgen = coll.mcCollision_as(); - if (std::abs(mccolgen.posZ()) > cVtxZcut) { return; } - const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); - histos.fill(HIST("hVtxZ_after_gen"), mccolgen.posZ()); - - double nCh_gen = 0., nCh_gen_all = 0., nCh_gen_true = 0.; - double nChpi_gen = 0., nChk_gen = 0., nChp_gen = 0.; - double nCh1 = 0., nCh2 = 0., nCh3 = 0., nCh4 = 0.; - - double Q1_gen = 0, Q2_gen = 0., Q1_gen_old = 0., Q2_gen_old = 0.; - double Q1pi_gen = 0, Q2pi_gen = 0, Q1k_gen = 0, Q2k_gen = 0, Q1p_gen = 0, Q2p_gen = 0 ; - - double var1_gen = 0, var2_gen = 0., var1_gen_old = 0., var2_gen_old = 0.; - double var1pi_gen = 0, var2pi_gen = 0, var1k_gen = 0, var2k_gen = 0, var1p_gen = 0, var2p_gen = 0; - - int sample_gen = histos.get(HIST("hVtxZ_after_gen"))->GetEntries(); - sample_gen = sample_gen % 30; - - - for (const auto& mcpart:mcpartgen){ - auto pdgcode = std::abs(mcpart.pdgCode()); - - if(!mcpart.isPhysicalPrimary()) {continue;} - nCh1++ ; - histos.fill(HIST("hnch1"), nCh1); -// if (!(pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == -211 || pdgcode == -321 || pdgcode == -2212 || pdgcode == 11 || pdgcode == 13)) continue; - nCh2++ ; - - histos.fill(HIST("hnch2"), nCh2); - - nCh3++ ; - histos.fill(HIST("hnch3"), nCh3); - - - - int pid = mcpart.pdgCode(); - auto sign = 0; - auto* pd = pdg->GetParticle(pid); - if (pd != nullptr) { - sign = pd->Charge()/3.; - } - if (sign == 0 ) { continue;} -// histos.fill(HIST("gen_hSign"), sign); - if (std::fabs(mcpart.eta()) > cEtacut) continue; - nCh_gen_true++; - histos.fill(HIST("hnch_gen_true"), nCh_gen_true); - - if ((mcpart.pt() <= cPtmincut) || (mcpart.pt() >= cPtmaxcut)) continue; - - histos.fill(HIST("hPt_gen"), mcpart.pt()); - histos.fill(HIST("hEta_gen"), mcpart.eta()); - - histos.fill(HIST("ptHistogram_allcharge_gen"), mcpart.pt()); - - - nCh_gen_all += 1.; - Q1_gen += mcpart.pt(); - Q2_gen += (mcpart.pt() * mcpart.pt()); - - histos.fill(HIST("hnch_gen_all"), nCh_gen_all); - - if (std::fabs(mcpart.y()) < 0.5) - { - if (mcpart.pdgCode() == 211 || mcpart.pdgCode() == -211 ) - { - histos.fill(HIST("ptHistogramPion"), mcpart.pt()); - nChpi_gen += 1.; - Q1pi_gen += mcpart.pt(); - Q2pi_gen += (mcpart.pt() * mcpart.pt()); - histos.fill(HIST("hnch_pi"), nChpi_gen); - - } - - if (mcpart.pdgCode() == 321 || mcpart.pdgCode() == -321) - { - histos.fill(HIST("ptHistogramKaon"), mcpart.pt()); - nChk_gen += 1.; - Q1k_gen += mcpart.pt(); - Q2k_gen += (mcpart.pt() * mcpart.pt()); - histos.fill(HIST("hnch_ka"), nChk_gen); - - - } - - if (mcpart.pdgCode() == 2212 || mcpart.pdgCode() == -2212) - { - histos.fill(HIST("ptHistogramProton"), mcpart.pt()); - nChp_gen += 1.; - Q1p_gen += mcpart.pt(); - Q2p_gen += (mcpart.pt() * mcpart.pt()); - histos.fill(HIST("hnch_pr"), nChp_gen); - - } - - }//|y| < 0.5 cut ends! - - }//particle - histos.fill(HIST("hcent_nacc_gen"), cent, nCh_gen); - - - if (nCh_gen_all < 2.0) return; - var1_gen = (Q1_gen * Q1_gen - Q2_gen) / (nCh_gen_all * (nCh_gen_all - 1)); - var2_gen = (Q1_gen / nCh_gen_all); - - if (nChpi_gen >= 2.0) - { - var1pi_gen = (Q1pi_gen * Q1pi_gen - Q2pi_gen) / (nChpi_gen * (nChpi_gen - 1)); - var2pi_gen = (Q1pi_gen / nChpi_gen); - } - - //----------------------- kaons --------------------------------------- - if (nChk_gen >= 2.0) - { - var1k_gen = (Q1k_gen * Q1k_gen - Q2k_gen) / (nChk_gen * (nChk_gen - 1)); - var2k_gen = (Q1k_gen / nChk_gen); - } - - //---------------------------- protons ---------------------------------- - if (nChp_gen >= 2.0) - { - var1p_gen = (Q1p_gen * Q1p_gen - Q2p_gen) / (nChp_gen * (nChp_gen - 1)); - var2p_gen = (Q1p_gen / nChp_gen); - } - - //-----------------------nch------------------------------------- - - histos.fill(HIST("hVar1x_gen"), sample_gen, nCh_gen_all, var1_gen); - histos.fill(HIST("hVar2x_gen"), sample_gen, nCh_gen_all, var2_gen); - histos.fill(HIST("hVarx_gen"), sample_gen, nCh_gen_all); - histos.fill(HIST("hVar2meanptx_gen"), nCh_gen_all, var2_gen); - - histos.fill(HIST("hVar1pix_gen"), sample_gen, nCh_gen_all, var1pi_gen); - histos.fill(HIST("hVar2pix_gen"), sample_gen, nCh_gen_all, var2pi_gen); - histos.fill(HIST("hVarpix_gen"), sample_gen, nChpi_gen); - histos.fill(HIST("hVar2meanptpix_gen"), nCh_gen_all, var2pi_gen); - - histos.fill(HIST("hVar1kx_gen"), sample_gen, nCh_gen_all, var1k_gen); - histos.fill(HIST("hVar2kx_gen"), sample_gen, nCh_gen_all, var2k_gen); - histos.fill(HIST("hVarkx_gen"), sample_gen, nChk_gen); - histos.fill(HIST("hVar2meanptkx_gen"), nCh_gen_all, var2k_gen); - - histos.fill(HIST("hVar1px_gen"), sample_gen, nCh_gen_all, var1p_gen); - histos.fill(HIST("hVar2px_gen"), sample_gen, nCh_gen_all, var2p_gen); - histos.fill(HIST("hVarpx_gen"), sample_gen, nChp_gen); - histos.fill(HIST("hVar2meanptpx_gen"), nCh_gen_all, var2p_gen); - - - } //void process -PROCESS_SWITCH(IdentifiedMeanPtFluctuations, processMcReco, "Process reconstructed", true); - -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; -} - - - From 25abc2a5deaab46c44e9a5171bf7e5f96062cb91 Mon Sep 17 00:00:00 2001 From: nidamalikk Date: Sat, 27 Sep 2025 17:28:22 +0530 Subject: [PATCH 13/14] added histograms for multiplicity correlation --- .../Tasks/netchargeFluctuations.cxx | 1280 +++++++++++------ 1 file changed, 845 insertions(+), 435 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index a5bf9bec9ee..b6534cb70ab 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -10,224 +10,420 @@ // or submit itself to any jurisdiction. /// \file netchargeFluctuations.cxx -/// \brief Calculate nu_dyn fluctuations +/// \brief Calculate net-charge fluctuations using nu_dyn observable /// For charged particles /// For RUN-3 /// /// \author Nida Malik -#include // Include for std::vector +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" -#include "Common/Core/trackUtilities.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/Core/TrackSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" + +#include "CCDB/BasicCCDBManager.h" #include "CommonConstants/MathConstants.h" -#include "Common/DataModel/FT0Corrected.h" -#include "Framework/AnalysisDataModel.h" +#include "CommonConstants/PhysicsConstants.h" #include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "PWGCF/Core/CorrelationContainer.h" -#include "PWGCF/Core/PairCuts.h" -#include "Common/CCDB/TriggerAliases.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "CommonConstants/PhysicsConstants.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" + #include "TProfile.h" #include "TProfile2D.h" #include "TRandom3.h" +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace std; using namespace o2::constants::physics; -namespace o2 -{ -namespace aod -{ -namespace net_charge -{ -DECLARE_SOA_COLUMN(PosCharge, posCharge, float); -DECLARE_SOA_COLUMN(NegCharge, negCharge, float); -DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negSqCharge, float); -DECLARE_SOA_COLUMN(TermPCharge, termPCharge, float); -DECLARE_SOA_COLUMN(TermNCharge, termNCharge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); -DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace net_charge - -namespace net_charge_gen -{ -DECLARE_SOA_COLUMN(PosCharge, posCharge, float); -DECLARE_SOA_COLUMN(NegCharge, negCharge, float); -DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negSqCharge, float); -DECLARE_SOA_COLUMN(TermPCharge, termPCharge, float); -DECLARE_SOA_COLUMN(TermNCharge, termNCharge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); -DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace net_charge_gen - -DECLARE_SOA_TABLE(NetCharge, "AOD", "NETChargefluct", - net_charge::PosCharge, - net_charge::NegCharge, - net_charge::PosSqCharge, - net_charge::NegSqCharge, - net_charge::TermPCharge, - net_charge::TermNCharge, - net_charge::PosNegCharge, - net_charge::Centrality); - -DECLARE_SOA_TABLE(NetChargeGen, "AOD", "NETfluctGen", - net_charge_gen::PosCharge, - net_charge_gen::NegCharge, - net_charge_gen::PosSqCharge, - net_charge_gen::NegSqCharge, - net_charge_gen::TermPCharge, - net_charge_gen::TermNCharge, - net_charge_gen::PosNegCharge, - net_charge_gen::Centrality); - -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 { - Produces netCharge; - Produces netChargeGen; - Service pdgService; +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + Service pdgService; + Service ccdb; + TRandom3* fRndm = new TRandom3(0); HistogramRegistry histogramRegistry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Configurables + 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"}; + Configurable vertexZcut{"vertexZcut", 10.f, "Vertex Z"}; - Configurable etaCut{"etaCut", 0.8, "Eta cut"}; + 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"}; + Configurable deltaEta{"deltaEta", 8, "Delta eta bin count"}; + 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 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 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", false, "ITS+TPC Vertex Selection"}; // pileup - Configurable cPileupReject{"cPileupReject", false, "Pileup rejection"}; // pileup + Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; // pileup Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup - Configurable cIsGoodITSLayers{"cIsGoodITSLayers", false, "Good ITS Layers All"}; // 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; + + 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; - // Initialization - float cent = 0.; - float mult = 0.; void init(o2::framework::InitContext&) { - const AxisSpec vtxzAxis = {80, -20, 20, "V_{Z} (cm)"}; - const AxisSpec dcaAxis = {250, -0.5, 0.5, "DCA_{xy} (cm)"}; - const AxisSpec dcazAxis = {250, -0.5, 0.5, "DCA_{z} (cm)"}; + 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"}; const AxisSpec centAxis = {100, 0., 100., "centrality"}; - const AxisSpec multAxis = {200, 0., 10000., "FT0M Amplitude"}; - const AxisSpec tpcChiAxis = {140, 0., 7., "Chi2"}; - const AxisSpec itsChiAxis = {80, 0., 40., "Chi2"}; - const AxisSpec crossedRowAxis = {160, 0., 160., "TPC Crossed rows"}; + const AxisSpec multAxis = {100000, 0., 100000., "FT0M Amplitude"}; + const AxisSpec tpcChiAxis = {700, 0., 7., "Chi2"}; + const AxisSpec itsChiAxis = {400, 0., 40., "Chi2"}; + const AxisSpec crossedRowAxis = {1600, 0., 160., "TPC Crossed rows"}; const AxisSpec eventsAxis = {10, 0, 10, ""}; const AxisSpec signAxis = {20, -10, 10, ""}; + const AxisSpec nchAxis = {5000, 0, 5000, "Nch"}; + const AxisSpec nch1Axis = {1500, 0, 1500, "Nch"}; + const AxisSpec nchpAxis = {50000, 0, 50000, "Nch"}; + const AxisSpec cent1Axis{centBining, "Multiplicity percentile from FT0M (%)"}; + + auto noSubsample = static_cast(cfgNSubsample); + float maxSubsample = 1.0 * noSubsample; + AxisSpec subsampleAxis = {noSubsample, 0.0, maxSubsample, "subsample no."}; + + 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}); + histogramRegistry.add("QA/hTPCCrossedrows_before", "", kTH1D, {crossedRowAxis}); + histogramRegistry.add("QA/hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); + histogramRegistry.add("QA/hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); + histogramRegistry.add("QA/hVtxZ_after", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("QA/hDcaXY_after", "", kTH1F, {dcaAxis}); + histogramRegistry.add("QA/hDcaZ_after", "", kTH1F, {dcazAxis}); + histogramRegistry.add("QA/hTPCchi2perCluster_after", "", kTH1D, {tpcChiAxis}); + histogramRegistry.add("QA/hITSchi2perCluster_after", "", kTH1D, {itsChiAxis}); + histogramRegistry.add("QA/hTPCCrossedrows_after", "", kTH1D, {crossedRowAxis}); + histogramRegistry.add("QA/hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); + histogramRegistry.add("QA/hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); + histogramRegistry.add("QA/hEta", "", kTH1F, {etaAxis}); + histogramRegistry.add("QA/cent_hEta", "", kTH2F, {cent1Axis, etaAxis}); + histogramRegistry.add("QA/hPt", "", kTH1F, {ptAxis}); + histogramRegistry.add("QA/cent_hPt", "", kTH2F, {cent1Axis, ptAxis}); + histogramRegistry.add("QA/hPt_eta", "", kTH2F, {ptAxis, etaAxis}); + histogramRegistry.add("QA/hCentrality", "", kTH1F, {centAxis}); + histogramRegistry.add("QA/hMultiplicity", "", kTH1F, {multAxis}); + + histogramRegistry.add("gen/hVtxZ_before", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("gen/hVtxZ_after", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("gen/hPt", "", kTH1F, {ptAxis}); + histogramRegistry.add("gen/cent_hPt", "", kTH2F, {centAxis, ptAxis}); + histogramRegistry.add("gen/hEta", "", kTH1F, {etaAxis}); + histogramRegistry.add("gen/cent_hEta", "", kTH2F, {centAxis, etaAxis}); + histogramRegistry.add("gen/hSign", "", kTH1F, {signAxis}); + histogramRegistry.add("gen/hPt_eta", "", kTH2F, {ptAxis, etaAxis}); + histogramRegistry.add("gen/cent_pos", "cent vs fpos", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_neg", "cent vs fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_termp", "cent vs termp", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_termn", "cent vs termn", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_pos_sq", "cent vs sqfpos", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_neg_sq", "cent vs sqfneg", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_posneg", "cent vs fpos*fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_nch", "cent vs nch", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/nch", "", kTH1F, {nchAxis}); + histogramRegistry.add("gen/delta_eta_eta", "delta_eta ", kTH1F, {etaAxis}); + histogramRegistry.add("gen/delta_eta_pos", "delta_eta vs fpos ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_neg", "delta_eta vs fneg ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_termp", "delta_eta vs termp ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_termn", "delta_eta vs termn ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_pos_sq", "delta_eta vs pos_sq ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_neg_sq", "delta_eta vs neg_sq ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_posneg", "delta_eta vs posneg ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_nch", "delta_eta vs nchGen ", kTProfile, {deltaEtaAxis}); + + histogramRegistry.add("data/nch", "", kTH1D, {nchAxis}); + histogramRegistry.add("data/cent_nch", "", kTProfile, {cent1Axis}); + histogramRegistry.add("data/nch_pos", "", kTH1D, {nchAxis}); + histogramRegistry.add("data/cent_nch_pos", "", kTH2D, {centAxis, nchAxis}); + histogramRegistry.add("data/nch_neg", "", kTH1D, {nchAxis}); + histogramRegistry.add("data/cent_nch_neg", "", kTH2D, {centAxis, nchAxis}); + histogramRegistry.add("data/nch_negpos", "", kTH1D, {nchpAxis}); + histogramRegistry.add("data/cent_nch_negpos", "", kTH2D, {centAxis, nchpAxis}); + histogramRegistry.add("data/cent_pos", "cent vs fpos", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_neg", "cent vs fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_termp", "cent vs termp", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_termn", "cent vs termn", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_pos_sq", "cent vs sqfpos", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_neg_sq", "cent vs sqfneg", kTProfile, {cent1Axis}); + 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}); + histogramRegistry.add("data/cent_pos_cor", "", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_neg_cor", "", kTProfile, {cent1Axis}); + histogramRegistry.add("data/delta_eta_cent", "Centrality", kTH1F, {cent1Axis}); + histogramRegistry.add("data/delta_eta_eta", "eta", kTH1F, {etaAxis}); + histogramRegistry.add("data/delta_eta_nchTotal", "delta_eta vs nchTotal", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_nch", "delta_eta vs nch", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_nchCor", "delta_eta vs nchCor", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_pos", "delta_eta vs fpos", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_neg", "delta_eta vs fneg", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_termp", "delta_eta vs termp", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_termn", "delta_eta vs termn", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_pos_sq", "delta_eta vs sqfpos", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_neg_sq", "delta_eta vs sqfneg", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_posneg", "delta_eta vs fpos*fneg", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_pos_cor", "delta_eta vs fpos_cor", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_neg_cor", "delta_eta vs fneg_cor", kTProfile, {deltaEtaAxis}); + + histogramRegistry.add("subsample/pos", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/neg", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/termp", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/termn", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/pos_sq", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/neg_sq", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/posneg", "", kTProfile2D, {cent1Axis, subsampleAxis}); + + histogramRegistry.add("subsample/gen/pos", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/neg", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/termp", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/termn", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/pos_sq", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/neg_sq", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/posneg", "", kTProfile2D, {cent1Axis, subsampleAxis}); + + histogramRegistry.add("subsample/delta_eta/pos", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/neg", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/termp", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/termn", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/pos_sq", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/neg_sq", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/posneg", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + + histogramRegistry.add("subsample/delta_eta/gen/pos", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/neg", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/termp", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/termn", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/pos_sq", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + 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); + ccdb->setLocalObjectValidityChecking(); + + TList* list = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); + efficiency = reinterpret_cast(list->FindObject("efficiency_Run3")); + if (!efficiency) { + LOGF(info, "FATAL!! Could not find required histograms in CCDB"); + } + } + } + +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) { - histogramRegistry.add("hVtxZ_before", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("hDcaXY_before", "", kTH1F, {dcaAxis}); - histogramRegistry.add("hDcaZ_before", "", kTH1F, {dcazAxis}); - histogramRegistry.add("hTPCchi2perCluster_before", "", kTH1D, {tpcChiAxis}); - histogramRegistry.add("hITSchi2perCluster_before", "", kTH1D, {itsChiAxis}); - histogramRegistry.add("hTPCCrossedrows_before", "", kTH1D, {crossedRowAxis}); - histogramRegistry.add("hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); - histogramRegistry.add("hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); - histogramRegistry.add("hVtxZ_after", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("hDcaXY_after", "", kTH1F, {dcaAxis}); - histogramRegistry.add("hDcaZ_after", "", kTH1F, {dcazAxis}); - histogramRegistry.add("hTPCchi2perCluster_after", "", kTH1D, {tpcChiAxis}); - histogramRegistry.add("hITSchi2perCluster_after", "", kTH1D, {itsChiAxis}); - histogramRegistry.add("hTPCCrossedrows_after", "", kTH1D, {crossedRowAxis}); - histogramRegistry.add("hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); - histogramRegistry.add("hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); - histogramRegistry.add("hEta", "", kTH1F, {etaAxis}); - histogramRegistry.add("hPt", "", kTH1F, {ptAxis}); - histogramRegistry.add("hCentrality", "", kTH1F, {centAxis}); - histogramRegistry.add("hMultiplicity", "", kTH1F, {multAxis}); - histogramRegistry.add("rec_hVtxZ_before", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("gen_hVtxZ_before", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("rec_hDcaXY_before", "", kTH1D, {dcaAxis}); - histogramRegistry.add("rec_hDcaZ_before", "", kTH1D, {dcazAxis}); - histogramRegistry.add("rec_hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {tpcChiAxis}); - histogramRegistry.add("rec_hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {itsChiAxis}); - histogramRegistry.add("rec_hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {crossedRowAxis}); - histogramRegistry.add("rec_hVtxZ_after", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("gen_hVtxZ_after", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("rec_hDcaXY_after", "", kTH1D, {dcaAxis}); - histogramRegistry.add("rec_hDcaZ_after", "", kTH1D, {dcazAxis}); - histogramRegistry.add("rec_hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {tpcChiAxis}); - histogramRegistry.add("rec_hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {itsChiAxis}); - histogramRegistry.add("rec_hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {crossedRowAxis}); - histogramRegistry.add("gen_hEta", "", kTH1F, {etaAxis}); - histogramRegistry.add("rec_hEta", "", kTH1F, {etaAxis}); - histogramRegistry.add("gen_hSign", "", kTH1F, {signAxis}); - histogramRegistry.add("gen_hPt", "", kTH1F, {ptAxis}); - histogramRegistry.add("rec_hPt", "", kTH1F, {ptAxis}); - histogramRegistry.add("rec_hPtDcaXY_after", "hPtDCAxy", kTH2D, {ptAxis, dcaAxis}); - histogramRegistry.add("rec_hPtDcaZ_after", "hPtDCAz", kTH2D, {ptAxis, dcazAxis}); - histogramRegistry.add("rec_hCentrality", "", kTH1D, {centAxis}); - histogramRegistry.add("gen_hCentrality", "", kTH1D, {centAxis}); - histogramRegistry.add("rec_hMultiplicity", "", kTH1D, {multAxis}); - histogramRegistry.add("gen_hMultiplicity", "", kTH1D, {multAxis}); + 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) + bool selCollision(C const& coll, float& cent, float& mult) { - if (std::abs(coll.posZ()) > vertexZcut) { - return false; - } // Reject the collisions with large vertex-z + if (std::abs(coll.posZ()) >= vertexZcut) + return false; if constexpr (run == kRun3) { - if (cSel8Trig && !coll.sel8()) { return false; - } // require min bias trigger - cent = coll.centFT0M(); // centrality for run3 - mult = coll.multFT0M(); // multiplicity for run3 - } else { + } + if (cFT0M) { + cent = coll.centFT0M(); // centrality for run3 using FT0M + mult = coll.multFT0M(); + } else if (cFT0C) { + cent = coll.centFT0C(); // centrality for run3 using FT0C + mult = coll.multFT0C(); + } + + } else if constexpr (run == kRun2) { if (cInt7Trig && !coll.alias_bit(kINT7)) { return false; } @@ -238,402 +434,616 @@ struct NetchargeFluctuations { mult = coll.multFV0M(); // multiplicity for run2 } - if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) return false; - } - - if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) return false; - } - - if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { + if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) return false; - } - - if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) return false; - } - - if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { + if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) return false; - } + if (cfgUseGoodItsLayerAllCut && !(coll.selection_bit(aod::evsel::kIsGoodITSLayersAll))) + return false; + + return true; + } + + template + void fillBeforeQA(T const& track) + { + histogramRegistry.fill(HIST("QA/hTPCchi2perCluster_before"), track.tpcChi2NCl()); + histogramRegistry.fill(HIST("QA/hITSchi2perCluster_before"), track.itsChi2NCl()); + histogramRegistry.fill(HIST("QA/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); + histogramRegistry.fill(HIST("QA/hDcaXY_before"), track.dcaXY()); + histogramRegistry.fill(HIST("QA/hDcaZ_before"), track.dcaZ()); + histogramRegistry.fill(HIST("QA/hPtDcaXY_before"), track.pt(), track.dcaXY()); + histogramRegistry.fill(HIST("QA/hPtDcaZ_before"), track.pt(), track.dcaZ()); + } - return true; // if all checks pass, accept the collision + 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()); + histogramRegistry.fill(HIST("QA/hEta"), track.eta()); + histogramRegistry.fill(HIST("QA/hPt_eta"), track.pt(), track.eta()); + histogramRegistry.fill(HIST("QA/hPtDcaXY_after"), track.pt(), track.dcaXY()); + histogramRegistry.fill(HIST("QA/hPtDcaZ_after"), track.pt(), track.dcaZ()); + histogramRegistry.fill(HIST("QA/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); + histogramRegistry.fill(HIST("QA/hTPCchi2perCluster_after"), track.tpcChi2NCl()); + histogramRegistry.fill(HIST("QA/hITSchi2perCluster_after"), track.itsChi2NCl()); } template bool selTrack(T const& track) { - if (!track.isGlobalTrack()) { + if (!track.isGlobalTrack()) return false; - } // accept only global tracks - - if (std::fabs(track.dcaXY()) > dcaXYCut) { + if (cPVcont && !track.isPVContributor()) return false; - } - - if (std::fabs(track.dcaZ()) > dcaZCut) { + if (std::fabs(track.eta()) >= etaCut) return false; - } - - if (std::fabs(track.eta()) >= etaCut) { + if (track.pt() <= ptMinCut || track.pt() >= ptMaxCut) return false; - } - - if (track.pt() <= ptMinCut || track.pt() >= ptMaxCut) { + if (track.sign() == 0) return false; - } - - if (track.tpcNClsCrossedRows() < tpcCrossCut) { + if (cDcaXy && std::fabs(track.dcaXY()) >= dcaXYCut) return false; - } - - if (track.itsChi2NCl() > itsChiCut) { + if (cDcaZ && std::fabs(track.dcaZ()) >= dcaZCut) return false; - } - - if (track.tpcChi2NCl() > tpcChiCut) { + if (cTpcCr && track.tpcNClsCrossedRows() <= tpcCrossCut) + return false; + if (cItsChi && track.itsChi2NCl() >= itsChiCut) + return false; + if (cTpcChi && track.tpcChi2NCl() >= tpcChiCut) return false; + + return true; + } + + double getEfficiency(float pt, TH1D* hEff) + { + if (!hEff) { + return 1e-6; } + int bin = hEff->GetXaxis()->FindBin(pt); + if (bin < 1 || bin > hEff->GetNbinsX()) { + return 1e-6; + } + double eff = hEff->GetBinContent(bin); + return eff; + } - return true; // if all checks pass, accept the collision + void fillHistograms(float nch, float cent, float fpos, float fneg, float posneg, float termp, float termn) + { + histogramRegistry.fill(HIST("data/nch"), nch); + histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); + histogramRegistry.fill(HIST("data/nch_pos"), fpos); + histogramRegistry.fill(HIST("data/cent_nch_pos"), cent, fpos); + histogramRegistry.fill(HIST("data/nch_neg"), fneg); + histogramRegistry.fill(HIST("data/cent_nch_neg"), cent, fneg); + histogramRegistry.fill(HIST("data/nch_negpos"), posneg); + histogramRegistry.fill(HIST("data/cent_nch_negpos"), cent, posneg); + + histogramRegistry.fill(HIST("data/cent_pos"), cent, fpos); + histogramRegistry.fill(HIST("data/cent_neg"), cent, fneg); + histogramRegistry.fill(HIST("data/cent_termp"), cent, termp); + histogramRegistry.fill(HIST("data/cent_termn"), cent, termn); + histogramRegistry.fill(HIST("data/cent_pos_sq"), cent, fpos * fpos); + histogramRegistry.fill(HIST("data/cent_neg_sq"), cent, fneg * fneg); + histogramRegistry.fill(HIST("data/cent_posneg"), cent, posneg); + + float lRandom = fRndm->Rndm(); + int sampleIndex = static_cast(cfgNSubsample * lRandom); + + histogramRegistry.fill(HIST("subsample/pos"), cent, sampleIndex, fpos); + histogramRegistry.fill(HIST("subsample/neg"), cent, sampleIndex, fneg); + histogramRegistry.fill(HIST("subsample/termp"), cent, sampleIndex, termp); + histogramRegistry.fill(HIST("subsample/termn"), cent, sampleIndex, termn); + histogramRegistry.fill(HIST("subsample/pos_sq"), cent, sampleIndex, fpos * fpos); + histogramRegistry.fill(HIST("subsample/neg_sq"), cent, sampleIndex, fneg * fneg); + histogramRegistry.fill(HIST("subsample/posneg"), cent, sampleIndex, posneg); } + template - void calculation(C const& coll, T const& tracks) + void calculationData(C const& coll, T const& tracks) { - histogramRegistry.fill(HIST("hVtxZ_before"), coll.posZ()); - - if (!selCollision(coll)) { + float cent = -1, mult = -1; + histogramRegistry.fill(HIST("QA/hVtxZ_before"), coll.posZ()); + if (!selCollision(coll, cent, mult)) { return; } - - histogramRegistry.fill(HIST("hVtxZ_after"), coll.posZ()); - histogramRegistry.fill(HIST("hCentrality"), cent); - histogramRegistry.fill(HIST("hMultiplicity"), mult); + + 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); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - + int nch = 0, nchTotal = 0; + double posWeight = 0, negWeight = 0, nchCor = 0, nchTotalCor = 0; for (const auto& track : tracks) { - histogramRegistry.fill(HIST("hTPCchi2perCluster_before"), track.tpcChi2NCl()); - histogramRegistry.fill(HIST("hITSchi2perCluster_before"), track.itsChi2NCl()); - histogramRegistry.fill(HIST("hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); - histogramRegistry.fill(HIST("hDcaXY_before"), track.dcaXY()); - histogramRegistry.fill(HIST("hDcaZ_before"), track.dcaZ()); - histogramRegistry.fill(HIST("hPtDcaXY_before"), track.pt(), track.dcaXY()); - histogramRegistry.fill(HIST("hPtDcaZ_before"), track.pt(), track.dcaZ()); - - if (!selTrack(track)) { - continue; - } - if (track.sign() == 0) + + double eff = getEfficiency(track.pt(), efficiency); + if (eff < threshold) continue; - histogramRegistry.fill(HIST("hDcaXY_after"), track.dcaXY()); - histogramRegistry.fill(HIST("hDcaZ_after"), track.dcaZ()); - histogramRegistry.fill(HIST("hPt"), track.pt()); - histogramRegistry.fill(HIST("hEta"), track.eta()); - histogramRegistry.fill(HIST("hPtDcaXY_after"), track.pt(), track.dcaXY()); - histogramRegistry.fill(HIST("hPtDcaZ_after"), track.pt(), track.dcaZ()); - histogramRegistry.fill(HIST("hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); - histogramRegistry.fill(HIST("hTPCchi2perCluster_after"), track.tpcChi2NCl()); - histogramRegistry.fill(HIST("hITSchi2perCluster_after"), track.itsChi2NCl()); + double weight = 1.0 / eff; + fillBeforeQA(track); + nchTotal += 1; + nchTotalCor += weight; + if (!selTrack(track)) + continue; + nch += 1; + fillAfterQA(track); + histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); + histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); + histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); + histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); + + nchCor += weight; if (track.sign() == 1) { fpos += 1; - termp = fpos * (fpos - 1); - } - - if (track.sign() == -1) { + posWeight += weight; + } else if (track.sign() == -1) { fneg += 1; - termn = fneg * (fneg - 1); + negWeight += weight; } - posneg = fpos * fneg; - netCharge(fpos, fneg, fpos * fpos, fneg * fneg, termp, termn, posneg, cent); - } // tracks - - return; + } // 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); + 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); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } template - void histosMcRecoGen(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles) + void calculationMc(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles) { (void)mcCollisions; if (!coll.has_mcCollision()) { return; } - - histogramRegistry.fill(HIST("gen_hVtxZ_before"), coll.mcCollision().posZ()); - histogramRegistry.fill(HIST("rec_hVtxZ_before"), coll.posZ()); - - if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { - return; - } - if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - return; - } - if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { - return; - } - if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; - } - if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { + histogramRegistry.fill(HIST("gen/hVtxZ_before"), coll.mcCollision().posZ()); + float cent = -1, mult = -1; + histogramRegistry.fill(HIST("QA/hVtxZ_before"), coll.posZ()); + if (!selCollision(coll, cent, mult)) { return; } - if (std::abs(coll.posZ()) > vertexZcut) { - 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); - if constexpr (run == kRun3) { - if (cSel8Trig && !coll.sel8()) { - return; - } + int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; + int nch = 0, nchCor = 0; + double posRecWeight = 0, negRecWeight = 0; - cent = coll.centFT0M(); // centrality for run3 - mult = coll.multFT0M(); - } else { - if (cSel7Trig && !coll.sel7()) { - return; - } + for (const auto& track : inputTracks) { + fillBeforeQA(track); + if (!selTrack(track)) + continue; + nch += 1; + fillAfterQA(track); + histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); + histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); - cent = coll.centRun2V0M(); // centrality for run2 - mult = coll.multFV0M(); // multiplicity for run2 - } + double eff = getEfficiency(track.pt(), efficiency); + 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); - histogramRegistry.fill(HIST("rec_hVtxZ_after"), coll.posZ()); - histogramRegistry.fill(HIST("rec_hCentrality"), cent); - histogramRegistry.fill(HIST("rec_hMultiplicity"), mult); + if (track.sign() == 1) { + fpos += 1; + posRecWeight += weight; + } else if (track.sign() == -1) { + fneg += 1; + negRecWeight += weight; + } + nchCor = posRecWeight + negRecWeight; + } // 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); - int posRec = 0, negRec = 0, posNegRec = 0, termNRec = 0, termPRec = 0; - int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0; + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); + + 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()); - - for (const auto& track : inputTracks) { - if (!track.isGlobalTrack()) + histogramRegistry.fill(HIST("gen/hVtxZ_after"), mccolgen.posZ()); + for (const auto& mcpart : mcpartgen) { + if (std::fabs(mcpart.eta()) >= etaCut) continue; - if (std::fabs(track.dcaXY()) > dcaXYCut) + if (!mcpart.isPhysicalPrimary()) continue; - if (std::fabs(track.dcaZ()) > dcaZCut) + int pid = mcpart.pdgCode(); + auto sign = 0; + auto* pd = pdgService->GetParticle(pid); + if (pd != nullptr) { + sign = pd->Charge() / 3.; + } + if (sign == 0) continue; - if (std::fabs(track.eta()) > etaCut) + if (std::abs(pid) != kElectron && + std::abs(pid) != kMuonMinus && + std::abs(pid) != kPiPlus && + std::abs(pid) != kKPlus && + std::abs(pid) != kProton) continue; - if ((track.pt() <= ptMinCut) || (track.pt() >= ptMaxCut)) + if (std::fabs(mcpart.eta()) >= etaCut) continue; - if (track.sign() == 0) { + if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) continue; + histogramRegistry.fill(HIST("gen/hPt"), mcpart.pt()); + histogramRegistry.fill(HIST("gen/cent_hPt"), cent, mcpart.pt()); + histogramRegistry.fill(HIST("gen/hEta"), mcpart.eta()); + histogramRegistry.fill(HIST("gen/cent_hEta"), cent, mcpart.eta()); + histogramRegistry.fill(HIST("gen/hSign"), sign); + histogramRegistry.fill(HIST("gen/hPt_eta"), mcpart.pt(), mcpart.eta()); + nchGen += 1; + if (sign == 1) { + posGen += 1; + } + if (sign == -1) { + negGen += 1; } + } + termPGen = posGen * (posGen - 1); + termNGen = negGen * (negGen - 1); + posNegGen = posGen * negGen; + histogramRegistry.fill(HIST("gen/cent_pos"), cent, posGen); + histogramRegistry.fill(HIST("gen/cent_neg"), cent, negGen); + histogramRegistry.fill(HIST("gen/cent_termp"), cent, termPGen); + histogramRegistry.fill(HIST("gen/cent_termn"), cent, termNGen); + histogramRegistry.fill(HIST("gen/cent_pos_sq"), cent, posGen * posGen); + histogramRegistry.fill(HIST("gen/cent_neg_sq"), cent, negGen * negGen); + histogramRegistry.fill(HIST("gen/cent_posneg"), cent, posNegGen); + histogramRegistry.fill(HIST("gen/cent_nch"), cent, nchGen); + histogramRegistry.fill(HIST("gen/nch"), nchGen); + + float lRandom = fRndm->Rndm(); + int sampleIndex = static_cast(cfgNSubsample * lRandom); + + histogramRegistry.fill(HIST("subsample/gen/pos"), cent, sampleIndex, posGen); + histogramRegistry.fill(HIST("subsample/gen/neg"), cent, sampleIndex, negGen); + histogramRegistry.fill(HIST("subsample/gen/termp"), cent, sampleIndex, termPGen); + histogramRegistry.fill(HIST("subsample/gen/termn"), cent, sampleIndex, termNGen); + histogramRegistry.fill(HIST("subsample/gen/pos_sq"), cent, sampleIndex, posGen * posGen); + histogramRegistry.fill(HIST("subsample/gen/neg_sq"), cent, sampleIndex, negGen * negGen); + histogramRegistry.fill(HIST("subsample/gen/posneg"), cent, sampleIndex, posNegGen); - histogramRegistry.fill(HIST("rec_hPt"), track.pt()); - histogramRegistry.fill(HIST("rec_hEta"), track.eta()); + } // void + + template + void calculationDeltaEta(C const& coll, T const& tracks, float deta1, float deta2) + { + 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); + + 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; + + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); if (track.sign() == 1) { - posRec += 1; - termPRec = posRec * (posRec - 1); + fpos++; + posWeight += weight; + } else if (track.sign() == -1) { + fneg++; + negWeight += weight; } + } + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; + + 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"), 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); + + 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); + } - if (track.sign() == -1) { - negRec += 1; - termNRec = negRec * (negRec - 1); + template + void calculationMcDeltaEta(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles, float deta1, float deta2) + { + (void)mcCollisions; + + if (!coll.has_mcCollision()) + return; + + 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); + + float deltaEtaWidth = deta2 - deta1 + 1e-5f; + + int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; + int nch = 0, nchTotal = 0; + double nchCor = 0, posRecWeight = 0, negRecWeight = 0; + + for (const auto& track : inputTracks) { + nchTotal += 1; + if (!selTrack(track)) + continue; + double eta = track.eta(); + if (eta < deta1 || eta > deta2) + continue; + + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); + double eff = getEfficiency(track.pt(), efficiency); + 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 + + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; + + 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"), 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); - posNegRec = posRec * negRec; + const auto& mccolgen = coll.template mcCollision_as(); + + if (std::abs(mccolgen.posZ()) >= vertexZcut) + return; - netCharge(posRec, negRec, posRec * posRec, negRec * negRec, - termPRec, termNRec, posNegRec, cent); - } // loop over inputTracks (reco) + const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); + int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; for (const auto& mcpart : mcpartgen) { - if (!mcpart.isPhysicalPrimary()) { + if (!mcpart.isPhysicalPrimary()) continue; - } + int pid = mcpart.pdgCode(); auto sign = 0; auto* pd = pdgService->GetParticle(pid); if (pd != nullptr) { sign = pd->Charge() / 3.; } - if (sign == 0) { + if (sign == 0) continue; - } - // auto pdgServicecode = mcpart.pdgCode(); - if (std::abs(pid) != kElectron && std::abs(pid) != kMuonMinus && std::abs(pid) != kPiPlus && std::abs(pid) != kKPlus && std::abs(pid) != kProton) { + if (std::abs(pid) != kElectron && + std::abs(pid) != kMuonMinus && + std::abs(pid) != kPiPlus && + std::abs(pid) != kKPlus && + std::abs(pid) != kProton) continue; - } - if (std::fabs(mcpart.eta()) > etaCut) + if (std::fabs(mcpart.eta()) >= etaCut) continue; if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) continue; - histogramRegistry.fill(HIST("gen_hPt"), mcpart.pt()); - histogramRegistry.fill(HIST("gen_hEta"), mcpart.eta()); - histogramRegistry.fill(HIST("gen_hSign"), sign); + double mcEta = mcpart.eta(); + if (mcEta < deta1 || mcEta > deta2) + continue; + + histogramRegistry.fill(HIST("gen/delta_eta_eta"), mcpart.eta()); + + nchGen += 1; if (sign == 1) { posGen += 1; - termPGen = posGen * (posGen - 1); } - if (sign == -1) { negGen += 1; - termNGen = negGen * (negGen - 1); } + } - posNegGen = posGen * negGen; - - netChargeGen(posGen, negGen, posGen * posGen, negGen * negGen, - termPGen, termNGen, posNegGen, cent); + termPGen = posGen * (posGen - 1); + termNGen = negGen * (negGen - 1); + posNegGen = posGen * negGen; + + histogramRegistry.fill(HIST("gen/delta_eta_pos"), deltaEtaWidth, posGen); + histogramRegistry.fill(HIST("gen/delta_eta_neg"), deltaEtaWidth, negGen); + histogramRegistry.fill(HIST("gen/delta_eta_termp"), deltaEtaWidth, termPGen); + histogramRegistry.fill(HIST("gen/delta_eta_termn"), deltaEtaWidth, termNGen); + histogramRegistry.fill(HIST("gen/delta_eta_pos_sq"), deltaEtaWidth, posGen * posGen); + histogramRegistry.fill(HIST("gen/delta_eta_neg_sq"), deltaEtaWidth, negGen * negGen); + histogramRegistry.fill(HIST("gen/delta_eta_posneg"), deltaEtaWidth, posNegGen); + histogramRegistry.fill(HIST("gen/delta_eta_nch"), deltaEtaWidth, nchGen); + + float lRandom = fRndm->Rndm(); + int sampleIndex = static_cast(cfgNSubsample * lRandom); + + histogramRegistry.fill(HIST("subsample/delta_eta/gen/pos"), deltaEtaWidth, sampleIndex, posGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/neg"), deltaEtaWidth, sampleIndex, negGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/termp"), deltaEtaWidth, sampleIndex, termPGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/termn"), deltaEtaWidth, sampleIndex, termNGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/pos_sq"), deltaEtaWidth, sampleIndex, posGen * posGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/neg_sq"), deltaEtaWidth, sampleIndex, negGen * negGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/posneg"), deltaEtaWidth, sampleIndex, posNegGen); - } // particle } // void SliceCache cache; - Preslice mcTrack = o2::aod::mcparticle::mcCollisionId; + Preslice mcTrack = aod::mcparticle::mcCollisionId; - void processDataRun3(aod::MyCollisionRun3 const& coll, aod::MyTracks const& tracks) + // process function for Data Run3 + void processDataRun3(MyCollisionRun3 const& coll, MyTracks const& tracks) { - calculation(coll, tracks); + calculationData(coll, tracks); + for (int ii = 0; ii < deltaEta; ii++) { + float etaMin = -0.1f * (ii + 1); + float etaMax = 0.1f * (ii + 1); + + calculationDeltaEta(coll, tracks, etaMin, etaMax); + } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", false); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); - void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) + // process function for Data Run2 + void processDataRun2(MyCollisionRun2 const& coll, MyTracks const& tracks) { - calculation(coll, tracks); + calculationData(coll, tracks); + for (int ii = 0; ii < deltaEta; ii++) { + float etaMin = -0.1f * (ii + 1); // -0.1, -0.2, ..., -0.8 + float etaMax = 0.1f * (ii + 1); // +0.1, +0.2, ..., +0.8 + + calculationDeltaEta(coll, tracks, etaMin, etaMax); + } } PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); - void processMcRun3(aod::MyMCCollisionRun3 const& coll, aod::MyMCTracks const& inputTracks, + // process function for MC Run3 + + void processMcRun3(MyMCCollisionRun3 const& coll, MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - histosMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); + calculationMc(coll, inputTracks, mcCollisions, mcParticles); + for (int ii = 0; ii < deltaEta; ii++) { + float etaMin = -0.1f * (ii + 1); + float etaMax = 0.1f * (ii + 1); + 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 - 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) { - histosMcRecoGen(coll, inputTracks, mcCollisions, mcParticles); + calculationMc(coll, inputTracks, mcCollisions, mcParticles); + for (int ii = 0; ii < deltaEta; ii++) { + float etaMin = -0.1f * (ii + 1); + float etaMax = 0.1f * (ii + 1); + calculationMcDeltaEta(coll, inputTracks, mcCollisions, mcParticles, etaMin, etaMax); + } } PROCESS_SWITCH(NetchargeFluctuations, processMcRun2, "Process reconstructed", false); +}; -}; // struct - -struct NetchargeAnalysis { - Configurable cfSubSample{"cfSubSample", 30, "Number of subsamples"}; - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - std::vector>> net; - std::vector>> subSample; - std::vector>> genSubSample; - TRandom3* fRndm = new TRandom3(0); - - void init(o2::framework::InitContext&) - { - std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; - AxisSpec centAxis = {centBinning, "centrality"}; - - registry.add("data/pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - - registry.add("gen/pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - - subSample.resize(cfSubSample); - genSubSample.resize(cfSubSample); - - for (int i = 0; i < cfSubSample; ++i) { - subSample[i].resize(7); - genSubSample[i].resize(7); - - subSample[i][0] = std::get>(registry.add(Form("data/subSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][1] = std::get>(registry.add(Form("data/subSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][2] = std::get>(registry.add(Form("data/subSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][3] = std::get>(registry.add(Form("data/subSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][4] = std::get>(registry.add(Form("data/subSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][5] = std::get>(registry.add(Form("data/subSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][6] = std::get>(registry.add(Form("data/subSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - - genSubSample[i][0] = std::get>(registry.add(Form("gen/genSubSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][1] = std::get>(registry.add(Form("gen/genSubSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][2] = std::get>(registry.add(Form("gen/genSubSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][3] = std::get>(registry.add(Form("gen/genSubSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][4] = std::get>(registry.add(Form("gen/genSubSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][5] = std::get>(registry.add(Form("gen/genSubSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][6] = std::get>(registry.add(Form("gen/genSubSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - } - - } // void - - void processData(aod::NetCharge::iterator const& event_netcharge) - { - registry.get(HIST("data/pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - registry.get(HIST("data/neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - registry.get(HIST("data/termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); - registry.get(HIST("data/termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); - registry.get(HIST("data/pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); - registry.get(HIST("data/neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); - registry.get(HIST("data/posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); - - int sampleIndex = static_cast(cfSubSample * fRndm->Rndm()); - subSample[sampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - subSample[sampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - subSample[sampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); - subSample[sampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); - subSample[sampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); - subSample[sampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); - subSample[sampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); - } // void - PROCESS_SWITCH(NetchargeAnalysis, processData, "Process reconstructed and Data", true); - - void processGen(aod::NetChargeGen::iterator const& event_netcharge) - { - registry.get(HIST("gen/pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - registry.get(HIST("gen/neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - registry.get(HIST("gen/termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); - registry.get(HIST("gen/termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); - registry.get(HIST("gen/pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); - registry.get(HIST("gen/neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); - registry.get(HIST("gen/posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); - - int sampleIndex = static_cast(cfSubSample * fRndm->Rndm()); - genSubSample[sampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - genSubSample[sampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - genSubSample[sampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); - genSubSample[sampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); - genSubSample[sampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); - genSubSample[sampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); - genSubSample[sampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); - } // void - PROCESS_SWITCH(NetchargeAnalysis, processGen, "Process generated", true); - -}; // struct Netcharge_analysis - +// struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - {adaptAnalysisTask(cfgc)}, - {adaptAnalysisTask(cfgc)} - - }; + {adaptAnalysisTask(cfgc)}}; } From d325b69d527f42131e9fe36cdc1cae31f6362876 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Sat, 27 Sep 2025 12:01:50 +0000 Subject: [PATCH 14/14] Please consider the following formatting changes --- .../Tasks/netchargeFluctuations.cxx | 247 +++++++++--------- 1 file changed, 126 insertions(+), 121 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index b6534cb70ab..24cddfeba2c 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -45,7 +45,7 @@ #include "TRandom3.h" #include -#include +#include using namespace o2; using namespace o2::framework; @@ -88,10 +88,10 @@ 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 cDcaXy{"cDcaXy", true, "Dca XY cut"}; + 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"}; @@ -101,67 +101,67 @@ struct NetchargeFluctuations { 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"}; + 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 { + 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"}; + 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> 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> 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> 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"}; + 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"}; - std::vector multPVT0CCutPars; - std::vector multGlobalFT0CPars; - std::vector multGlobalPVCutPars; + 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"}; - TF1* fMultPVT0CCutLow = nullptr; - TF1* fMultPVT0CCutHigh = nullptr; - TF1* fMultGlobalFT0CCutLow = nullptr; - TF1* fMultGlobalFT0CCutHigh = nullptr; - TF1* fMultGlobalPVCutLow = nullptr; - TF1* fMultGlobalPVCutHigh = nullptr; + std::vector multPVT0CCutPars; + std::vector multGlobalFT0CPars; + std::vector multGlobalPVCutPars; -} cfgFunCoeff; + 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; - + Filter collisionFilter = nabs(aod::collision::posZ) <= vertexZcut; - Filter trackFilter = (nabs(aod::track::eta) < etaCut) && (aod::track::pt > ptMinCut ) && (aod::track::pt < ptMaxCut) && (requireGlobalTrackInFilter()); + 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 MyCollisionsRun2 = soa::Filtered>; + using MyCollisionRun2 = MyCollisionsRun2::iterator; - using MyCollisionsRun3 = soa::Filtered>; - using MyCollisionRun3 = MyCollisionsRun3::iterator; + using MyCollisionsRun3 = soa::Filtered>; + using MyCollisionRun3 = MyCollisionsRun3::iterator; - using MyTracks = soa::Filtered>; - using MyTrack = MyTracks::iterator; + using MyTracks = soa::Filtered>; + using MyTrack = MyTracks::iterator; - using MyMCCollisionsRun2 =soa::Filtered>; - using MyMCCollisionRun2 = MyMCCollisionsRun2::iterator; + using MyMCCollisionsRun2 = soa::Filtered>; + using MyMCCollisionRun2 = MyMCCollisionsRun2::iterator; - using MyMCCollisionsRun3 = soa::Filtered>; - using MyMCCollisionRun3 = MyMCCollisionsRun3::iterator; + using MyMCCollisionsRun3 = soa::Filtered>; + using MyMCCollisionRun3 = MyMCCollisionsRun3::iterator; - using MyMCTracks = soa::Filtered>; - using MyMCTrack = MyMCTracks::iterator; + using MyMCTracks = soa::Filtered>; + using MyMCTrack = MyMCTracks::iterator; void init(o2::framework::InitContext&) { @@ -325,44 +325,44 @@ Configurable> cfgMultGlobalPVCutPars{ "cfgMultGlobalPVCutPa cfgFunCoeff.multPVT0CCutPars = cfgFunCoeff.cfgMultPVT0CCutPars; cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars; - cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; + cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; - cfgFunCoeff.fMultPVT0CCutLow = + 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.fMultPVT0CCutLow->SetParameters(&(cfgFunCoeff.multPVT0CCutPars[0])); - cfgFunCoeff.fMultPVT0CCutHigh = + 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.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.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.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 = + cfgFunCoeff.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", - "[0] + [1]*x - 5.*([2] + [3]*x)", + "[0] + [1]*x - 5.*([2] + [3]*x)", 0, 100); - cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); - cfgFunCoeff.fMultGlobalPVCutHigh = + cfgFunCoeff.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", - "[0] + [1]*x + 5.*([2] + [3]*x)", + "[0] + [1]*x + 5.*([2] + [3]*x)", 0, 100); - cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); - + cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + if (cfgLoadEff) { ccdb->setURL(cfgUrlCCDB.value); ccdb->setCaching(true); @@ -376,34 +376,34 @@ cfgFunCoeff.fMultGlobalFT0CCutHigh->SetParameters(&(cfgFunCoeff.multGlobalFT0CPa } } -bool eventSelected(const float& globalNch, const float& pvTrack, const float& centrality) -{ - if (cfgFunCoeff.cfgMultPVT0CCutEnabled) { + 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 (pvTrack < cfgFunCoeff.fMultPVT0CCutLow->Eval(centrality)) + return false; + if (pvTrack > cfgFunCoeff.fMultPVT0CCutHigh->Eval(centrality)) + return false; + } - if (cfgFunCoeff.cfgMultGlobalFT0CCutEnabled) { + if (cfgFunCoeff.cfgMultGlobalFT0CCutEnabled) { - if (globalNch < cfgFunCoeff.fMultGlobalFT0CCutLow->Eval(centrality)) - return false; - if (globalNch > cfgFunCoeff.fMultGlobalFT0CCutHigh->Eval(centrality)) - return false; - } + 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; - } + if (cfgFunCoeff.cfgMultGlobalPVCutEnabled) { - return true; -} + 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) @@ -414,7 +414,7 @@ bool eventSelected(const float& globalNch, const float& pvTrack, const float& ce if constexpr (run == kRun3) { if (cSel8Trig && !coll.sel8()) { return false; - } + } if (cFT0M) { cent = coll.centFT0M(); // centrality for run3 using FT0M mult = coll.multFT0M(); @@ -483,7 +483,7 @@ bool eventSelected(const float& globalNch, const float& pvTrack, const float& ce { if (!track.isGlobalTrack()) return false; - if (cPVcont && !track.isPVContributor()) + if (cPVcont && !track.isPVContributor()) return false; if (std::fabs(track.eta()) >= etaCut) return false; @@ -549,28 +549,29 @@ bool eventSelected(const float& globalNch, const float& pvTrack, const float& ce histogramRegistry.fill(HIST("subsample/posneg"), cent, sampleIndex, posneg); } - template void calculationData(C const& coll, T const& tracks) { - float cent = -1, mult = -1; + float cent = -1, mult = -1; histogramRegistry.fill(HIST("QA/hVtxZ_before"), coll.posZ()); if (!selCollision(coll, cent, mult)) { return; } - - float globalNch = tracks.size(); - float pvTrack = coll.multNTracksPV(); + + 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("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/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); @@ -613,7 +614,7 @@ bool eventSelected(const float& globalNch, const float& pvTrack, const float& ce 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); @@ -638,18 +639,20 @@ bool eventSelected(const float& globalNch, const float& pvTrack, const float& ce return; } - int globalNch = inputTracks.size(); - int pvTrack = coll.multNTracksPV(); + 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("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/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); @@ -775,9 +778,10 @@ bool eventSelected(const float& globalNch, const float& pvTrack, const float& ce if (!selCollision(coll, cent, mult)) return; - int globalNch = tracks.size(); - int pvTrack = coll.multNTracksPV(); - if(cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) return; + int globalNch = tracks.size(); + int pvTrack = coll.multNTracksPV(); + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) + return; if (!(cent >= centMin && cent < centMax)) return; @@ -852,9 +856,10 @@ bool eventSelected(const float& globalNch, const float& pvTrack, const float& ce if (!selCollision(coll, cent, mult)) return; - int globalNch = inputTracks.size(); - int pvTrack = coll.multNTracksPV(); - if(cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) return; + int globalNch = inputTracks.size(); + int pvTrack = coll.multNTracksPV(); + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) + return; if (!(cent >= centMin && cent < centMax)) return;