diff --git a/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx b/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx index 56161b37473..6cf50aebc16 100644 --- a/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx @@ -16,6 +16,7 @@ /// /// \author Tanu Gahlaut +#include #include #include @@ -41,10 +42,10 @@ using namespace o2::constants::physics; using namespace std; struct MeanPtFlucId { - Configurable nPtBins{"nPtBins", 300, ""}; + Configurable nPBins{"nPBins", 300, ""}; Configurable nPartBins{"nPartBins", 250, ""}; Configurable nCentBins{"nCentBins", 101, ""}; - Configurable nEtaBins{"nEtaBins", 100, ""}; + Configurable nRapBins{"nRapBins", 100, ""}; Configurable nPhiBins{"nPhiBins", 100, ""}; Configurable cfgCutPtMax{"cfgCutPtMax", 3.0, "maximum pT"}; Configurable cfgCutPtMin{"cfgCutPtMin", 0.15, "minimum pT"}; @@ -69,23 +70,23 @@ struct MeanPtFlucId { Configurable cfgCutKaP3{"cfgCutKaP3", 1.2, "kaon p cut-3"}; Configurable cfgCutPrP1{"cfgCutPrP1", 0.9, "proton p cut-1"}; Configurable cfgCutPrP2{"cfgCutPrP2", 1.0, "proton p cut-2"}; - Configurable cfgMcTpcShiftEl{"cfgMcTpcShiftEl", 0., "Electron Shift in TPC (MC data) "}; - Configurable cfgMcTpcShiftPi{"cfgMcTpcShiftPi", 0., "Pion Shift in TPC (MC data) "}; - Configurable cfgMcTpcShiftKa{"cfgMcTpcShiftKa", 0., "Kaon Shift in TPC (MC data) "}; - Configurable cfgMcTpcShiftPr{"cfgMcTpcShiftPr", 0., "Proton Shift in TPC (MC data) "}; - Configurable cfgMcTofShiftPi{"cfgMcTofShiftPi", 0., "Pion Shift in TOF (MC data) "}; - Configurable cfgMcTofShiftKa{"cfgMcTofShiftKa", 0., "Kaon Shift in TOF (MC data) "}; - Configurable cfgMcTofShiftPr{"cfgMcTofShiftPr", 0., "Proton Shift in TOF (MC data) "}; + Configurable cfgRun3{"cfgRun3", true, ""}; + Configurable cfgRun2{"cfgRun2", false, ""}; Configurable cfgCorrection{"cfgCorrection", true, "Efficiency Correction"}; + Configurable cfgCorrectionPtEta{"cfgCorrectionPtEta", false, "Efficiency Correction for pT and eta"}; Configurable cfgPidCut{"cfgPidCut", false, ""}; Configurable cfgPDGCodeOnly{"cfgPDGCodeOnly", true, ""}; Configurable cfgMCReco{"cfgMCReco", false, ""}; Configurable cfgMCTruth{"cfgMCTruth", false, ""}; Configurable cfgPosZ{"cfgPosZ", true, "Position Z"}; + Configurable cfgSel7{"cfgSel7", true, "Run2 Sel7 trigger"}; + Configurable cfgkINT7{"cfgkINT7", true, "Run2 MB trigger"}; Configurable cfgSel8{"cfgSel8", true, "Sel8 trigger"}; - Configurable cfgEvSel1{"cfgEvSel1", true, "kNoSameBunchPileup"}; - Configurable cfgEvSel2{"cfgEvSel2", true, "kIsGoodZvtxFT0vsPV"}; - Configurable cfgEvSel3{"cfgEvSel3", true, "kIsVertexITSTPC"}; + Configurable cfgNoSameBunchPileup{"cfgNoSameBunchPileup", true, "kNoSameBunchPileup"}; + Configurable cfgIsVertexITSTPC{"cfgIsVertexITSTPC", true, "kIsVertexITSTPC"}; + Configurable cfgIsGoodZvtxFT0vsPV{"cfgIsGoodZvtxFT0vsPV", true, "kIsGoodZvtxFT0vsPV"}; + Configurable cfgTVXinTRD{"cfgTVXinTRD", true, "cfgTVXinTRD"}; + Configurable cfgNoCollInTimeRangeStandard{"cfgNoCollInTimeRangeStandard", true, "cfgNoCollInTimeRangeStandard"}; Configurable cfgRejTrk{"cfgRejTrk", true, "Rejected Tracks"}; Configurable cfgInvMass{"cfgInvMass", true, "electron Inv Mass cut selection"}; Configurable cfgSelOR{"cfgSelOR", true, "Low OR High momentum "}; @@ -100,21 +101,23 @@ struct MeanPtFlucId { ConfigurableAxis qNBins{"qNBins", {1000, 0., 100.}, "nth moments bins"}; ConfigurableAxis tpNBins{"tpNBins", {300, 0., 3000.}, ""}; ConfigurableAxis tpDBins{"tpDBins", {100, 0., 2000.}, ""}; - Configurable> effBinsCh{"effBinsCh", {0.0, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97}, "efficiency bins (pT values) Charged Particles"}; - Configurable> effValuesCh{"effValuesCh", {0, 0, 0.435317, 0.494436, 0.503395, 0.502586, 0.512747, 0.520725, 0.529907, 0.539101, 0.54681, 0.553512, 0.560189, 0.565234, 0.569757, 0.574745, 0.57974, 0.583599, 0.589339, 0.594742, 0.60012, 0.604169, 0.607755, 0.611133, 0.613578, 0.616077, 0.618396, 0.619847, 0.621875, 0.623413, 0.627201, 0.627984, 0.631526, 0.632296, 0.63471, 0.63624, 0.637429, 0.638796, 0.640041, 0.640788, 0.641945, 0.643148, 0.643847, 0.644747, 0.645518, 0.64564, 0.64666, 0.648487, 0.648268}, "effeciency values for Charged Particles"}; - Configurable> effBinsPi{"effBinsPi", {0.0, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97}, "efficiency bins (pT values) Pions"}; - Configurable> effValuesPi{"effValuesPi", {0, 0, 0, 0.408355, 0.488592, 0.509333, 0.497128, 0.507991, 0.496943, 0.40662, 0.258538, 0.243233, 0.241846, 0.250071, 0.262291, 0.248057, 0.267254, 0.26737, 0.265936, 0.281005, 0.274334, 0.27516, 0.300657, 0.289959, 0.282069, 0.294051, 0.301641, 0.303343, 0.307977, 0.29608, 0.331465, 0.32967, 0.336072, 0.30333, 0.348004, 0.38252, 0.327522, 0.377358, 0.367223, 0.330389, 0.34334, 0.35343, 0.358242, 0.341523, 0.369942, 0.341176, 0.317784, 0.384083, 0.359504, 0.375}, "effeciency values for Pions"}; - Configurable> effBinsKa{"effBinsKa", {0.03, 0.09, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97}, "efficiency bins (pT values) Kaons"}; - Configurable> effValuesKa{"effValuesKa", {0, 0, 0, 0, 0, 0.365424, 0.370427, 0.386149, 0.360516, 0.266547, 0.145036, 0.145861, 0.154678, 0.15995, 0.1826, 0.198502, 0.187345, 0.187205, 0.183396, 0.223104, 0.176249, 0.215336, 0.227273, 0.233509, 0.193033, 0.25, 0.258528, 0.264529, 0.272912, 0.311301, 0.316708, 0.367816, 0.391304, 0.406897, 0.412214, 0.44843, 0.448718, 0.55665, 0.429319, 0.438272, 0.455621, 0.458647, 0.585366, 0.632812, 0.586777, 0.576087, 0.561798, 0.869565, 0.581395, 0.693548}, "effeciency values for Kaons"}; - Configurable> effBinsPr{"effBinsPr", {0.0, 0.03, 0.09, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97}, "efficiency bins (pT values) Protons"}; - Configurable> effValuesPr{"effValuesPr", {0, 0, 0, 0, 0, 0, 0, 0, 0.595092, 0.551847, 0.519799, 0.52448, 0.52731, 0.510297, 0.495957, 0.422495, 0.348326, 0.29927, 0.263708, 0.256588, 0.261725, 0.296721, 0.240589, 0.299127, 0.292776, 0.238776, 0.319372, 0.305882, 0.27451, 0.262295, 0.302548, 0.228669, 0.301653, 0.279817, 0.271028, 0.278947, 0.370861, 0.271605, 0.421488, 0.315385, 0.322581, 0.526882, 0.397959, 0.574468, 0.564103, 0.380435, 0.296296, 0.368421, 0.480769, 0.413333}, "effeciency values for Protons"}; + 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> etaBins{"etaBins", {-0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8}, "#eta bins"}; + Configurable> rapBins{"rapBins", {-0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6}, "#rap bins"}; + Configurable> effValuesCh{"effValuesCh", {0, 0.429014, 0.487349, 0.491862, 0.487173, 0.493464, 0.502531, 0.510066, 0.517214, 0.524902, 0.529725, 0.537065, 0.542265, 0.546103, 0.549713, 0.555139, 0.55158, 0.562156, 0.563038, 0.568055, 0.570847, 0.580461, 0.580406, 0.585776, 0.587068, 0.598144, 0.590378, 0.609363, 0.607307, 0.604931, 0.6011, 0.593467, 0.61525, 0.61393, 0.61495, 0.610359, 0.622616}, "effeciency values for Charged Particles"}; + Configurable> effPtValuesPi{"effPtValuesPi", {0, 0.408075, 0.473332, 0.48221, 0.469699, 0.472676, 0.482403, 0.478351, 0.38468, 0.249696, 0.244316, 0.235498, 0.236493, 0.241719, 0.245363, 0.248324, 0.251595, 0.254327, 0.257727, 0.260208, 0.263414, 0.267699, 0.270322, 0.275128, 0.280835, 0.284328, 0.288791, 0.294786, 0.292418, 0.299766, 0.299413, 0.301257, 0.305466, 0.304929, 0.316837, 0.317915, 0.316018}, "effeciency values for Pions"}; + Configurable> effPtEtaValuesPi{"effPtEtaValuesPi", {0, 0, 0, 0.400058, 0.469632, 0.481628, 0.470343, 0.479434, 0.485532, 0.399748, 0.252337, 0.242448, 0.238033, 0.241385, 0.247947, 0.251316, 0.253647, 0.259705, 0.26139, 0.26566, 0.270122, 0.273559, 0.281532, 0.28531, 0.290786, 0.296129, 0.298688, 0.302411, 0.304526, 0.309276, 0.310814, 0.319945, 0.322188, 0.323646, 0.333198, 0.342838, 0.349902, 0.349663, 0.357027, 0.361007, 0.361765, 0.366801, 0.369578, 0.369184, 0.375378, 0.392854, 0.381762, 0.393439, 0.40179, 0.388955}, "pT eta effeciency values for Pions"}; + Configurable> effPtValuesKa{"effPtValuesKa", {0, 0, 0, 0.312144, 0.369847, 0.38878, 0.413275, 0.393619, 0.315429, 0.1375, 0.146659, 0.147163, 0.155197, 0.163588, 0.168412, 0.177936, 0.17782, 0.186872, 0.190744, 0.199436, 0.197739, 0.192307, 0.198484, 0.19927, 0.218019, 0.221942, 0.237642, 0.235765, 0.249873, 0.251034, 0.259014, 0.268821, 0.275786, 0.280998, 0.29936, 0.304559, 0.312684}, " effeciency values for Kaons"}; + Configurable> effPtEtaValuesKa{"effPtEtaValuesKa", {0, 0, 0, 0.400058, 0.469632, 0.481628, 0.470343, 0.479434, 0.485532, 0.399748, 0.252337, 0.242448, 0.238033, 0.241385, 0.247947, 0.251316, 0.253647, 0.259705, 0.26139, 0.26566, 0.270122, 0.273559, 0.281532, 0.28531, 0.290786, 0.296129, 0.298688, 0.302411, 0.304526, 0.309276, 0.310814, 0.319945, 0.322188, 0.323646, 0.333198, 0.342838, 0.349902, 0.349663, 0.357027, 0.361007, 0.361765, 0.366801, 0.369578, 0.369184, 0.375378, 0.392854, 0.381762, 0.393439, 0.40179, 0.388955}, "pT eta effeciency values for Kaons"}; + Configurable> effPtValuesPr{"effPtValuesPr", {0, 0, 0, 0, 0, 0, 0, 0.394712, 0.425251, 0.458426, 0.489121, 0.509505, 0.516103, 0.517117, 0.491584, 0.450721, 0.379836, 0.253402, 0.257575, 0.261382, 0.260373, 0.269008, 0.266811, 0.265011, 0.272768, 0.269553, 0.276003, 0.279878, 0.284216, 0.276346, 0.293437, 0.294727, 0.281017, 0.287609, 0.292402, 0.28614, 0.307208}, "effeciency values for Protons"}; + Configurable> effPtEtaValuesPr{"effPtEtaValuesPr", {0, 0, 0, 0, 0, 0, 0, 0, 0.393911, 0.422401, 0.462856, 0.498792, 0.512802, 0.518289, 0.495488, 0.448937, 0.331976, 0.256772, 0.26324, 0.265401, 0.270093, 0.273197, 0.27106, 0.277618, 0.276226, 0.28206, 0.289245, 0.285692, 0.29644, 0.282871, 0.28963, 0.29263, 0.29947, 0.30137, 0.311748, 0.326481, 0.321903, 0.334281, 0.342607, 0.374238, 0.356596, 0.398134, 0.386997, 0.382202, 0.390039, 0.390761, 0.4034, 0.4193, 0.405995, 0.408471}, "pT eta effeciency values for Protons"}; using MyAllTracks = soa::Join; - using MyCollisions = soa::Join; - using MyMCCollisions = soa::Join; + using MyRun3Collisions = soa::Join; + using MyRun3MCCollisions = soa::Join; using MyMCTracks = soa::Join ", kTH1D, {axisMeanPt}); @@ -314,9 +358,9 @@ struct MeanPtFlucId { hist.add("Gen/Charged/h_Q3", "Q3", qNMCHist); hist.add("Gen/Charged/h_Q4", "Q4", qNMCHist); hist.add("Gen/Charged/h_Q1_var", "Q1 vs N_{TPC}", qNMCHist); - hist.add("Gen/Charged/h_N_var", "N vs N_{TPC}", kTHnSparseD, {axisMultTPC, axisMult, axisMultFT0MMC}); - hist.add("Gen/Charged/h_twopart_nume_Mult_var", "twopart numerator", kTHnSparseD, {axisMultTPC, axisTpN, axisMultFT0MMC}); - hist.add("Gen/Charged/h_twopart_deno_Mult_var", "twopart denominator", kTHnSparseD, {axisMultTPC, axisTpD, axisMultFT0MMC}); + hist.add("Gen/Charged/h_N_var", "N vs N_{TPC}", kTHnSparseD, {axisMultTPC, axisMult, axisMultFT0M}); + hist.add("Gen/Charged/h_twopart_nume_Mult_var", "twopart numerator", kTHnSparseD, {axisMultTPC, axisTpN, axisMultFT0M}); + hist.add("Gen/Charged/h_twopart_deno_Mult_var", "twopart denominator", kTHnSparseD, {axisMultTPC, axisTpD, axisMultFT0M}); hist.add("Gen/Charged/p_mean_pT_Mult_var", " ", kTProfile, {axisMultTPC}); hist.add("Gen/Charged/p_CheckNCh", " 1/denominator vs N_{TPC} ", kTProfile, {axisMultTPC}); @@ -369,25 +413,39 @@ struct MeanPtFlucId { { hist.fill(HIST("QA/after/counts_evSelCuts"), 0); - if (cfgPosZ && std::abs(col.posZ()) > cfgCutPosZ) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 1); - - if (cfgSel8 && !col.sel8()) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 2); + if (cfgPosZ) { + if (std::abs(col.posZ()) > cfgCutPosZ) { + return false; + } + hist.fill(HIST("QA/after/counts_evSelCuts"), 1); + } - if (cfgEvSel1 && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 3); + if (cfgSel8) { + if (!col.sel8()) { + return false; + } + hist.fill(HIST("QA/after/counts_evSelCuts"), 2); + } + if (cfgNoSameBunchPileup) { + if (!col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + hist.fill(HIST("QA/after/counts_evSelCuts"), 4); + } - if (cfgEvSel2 && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 4); + if (cfgIsGoodZvtxFT0vsPV) { + if (!col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + hist.fill(HIST("QA/after/counts_evSelCuts"), 5); + } - if (cfgEvSel3 && !col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) - return false; - hist.fill(HIST("QA/after/counts_evSelCuts"), 5); + if (cfgIsVertexITSTPC) { + if (!col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + hist.fill(HIST("QA/after/counts_evSelCuts"), 6); + } return true; } @@ -396,7 +454,7 @@ struct MeanPtFlucId { template bool selTrack(T const& track) { - if (!track.isGlobalTrackWoPtEta()) + if (!track.isGlobalTrack()) return false; if (track.pt() < cfgCutPtMin) @@ -421,11 +479,11 @@ struct MeanPtFlucId { template bool rejectTracks(T const& track) { - if (((track.tpcNSigmaEl() - cfgMcTpcShiftEl) > -3. && - (track.tpcNSigmaEl() - cfgMcTpcShiftEl) < 5.) && - (std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) > 3 && - std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) > 3 && - std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) > 3)) { + if (((track.tpcNSigmaEl()) > -3. && + (track.tpcNSigmaEl()) < 5.) && + (std::fabs(track.tpcNSigmaPi()) > 3 && + std::fabs(track.tpcNSigmaKa()) > 3 && + std::fabs(track.tpcNSigmaPr()) > 3)) { return true; } @@ -435,7 +493,7 @@ struct MeanPtFlucId { template bool selElectrons(T const& track) { - if (std::fabs(track.tpcNSigmaEl() - cfgMcTpcShiftEl) < cfgCutNSig3) { + if (std::fabs(track.tpcNSigmaEl()) < cfgCutNSig3) { return true; } @@ -444,14 +502,19 @@ struct MeanPtFlucId { // PID selction cuts for Low momentum Pions template - bool selLowPi(T const& track, double p) + bool selLowPi(T const& track) { if (track.pt() >= cfgCutPiPtMin && track.p() <= cfgCutPiThrsldP && - ((std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig3 && p <= cfgCutPiP1) || - (std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig2 && p > cfgCutPiP1 && p <= cfgCutPiP2))) { + std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { + if (!track.hasTOF() && + std::fabs(track.tpcNSigmaPi()) < cfgCutNSig3) { + return true; + } - if (std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { + if (track.hasTOF() && + std::fabs(track.tpcNSigmaPi()) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPi()) < cfgCutNSig3) { return true; } } @@ -460,14 +523,19 @@ struct MeanPtFlucId { // PID selction cuts for Low momentum Kaons template - bool selLowKa(T const& track, double p) + bool selLowKa(T const& track) { if (track.pt() >= cfgCutKaPtMin && track.p() <= cfgCutKaThrsldP && - ((std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig3 && p <= cfgCutKaP1) || - (std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig2 && p > cfgCutKaP1 && p <= cfgCutKaP2))) { + std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { + if (!track.hasTOF() && + std::fabs(track.tpcNSigmaKa()) < cfgCutNSig3) { + return true; + } - if (std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { + if (track.hasTOF() && + std::fabs(track.tpcNSigmaKa()) < cfgCutNSig3 && + std::fabs(track.tofNSigmaKa()) < cfgCutNSig3) { return true; } } @@ -477,14 +545,19 @@ struct MeanPtFlucId { // PID selction cuts for Low momentum Protons template - bool selLowPr(T const& track, double p) + bool selLowPr(T const& track) { if (track.pt() >= cfgCutPrPtMin && track.p() <= cfgCutPrThrsldP && - ((std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig3 && p <= cfgCutPrP1) || - (std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig2 && p > cfgCutPrP1 && p <= cfgCutPrP2))) { + std::abs(track.rapidity(MassProton)) < cfgCutRap) { + if (!track.hasTOF() && + std::fabs(track.tpcNSigmaPr()) < cfgCutNSig3) { + return true; + } - if (std::abs(track.rapidity(MassProton)) < cfgCutRap) { + if (track.hasTOF() && + std::fabs(track.tpcNSigmaPr()) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPr()) < cfgCutNSig3) { return true; } } @@ -498,8 +571,8 @@ struct MeanPtFlucId { { if (track.hasTOF() && track.p() > cfgCutPiThrsldP && - std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig3 && - std::fabs(track.tofNSigmaPi() - cfgMcTofShiftPi) < cfgCutNSig3) { + std::fabs(track.tpcNSigmaPi()) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPi()) < cfgCutNSig3) { if (std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { return true; @@ -515,9 +588,9 @@ struct MeanPtFlucId { { if (track.hasTOF() && track.p() > cfgCutKaThrsldP && - std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig3 && - ((std::fabs(track.tofNSigmaKa() - cfgMcTofShiftKa) < cfgCutNSig3 && track.p() <= cfgCutKaP3) || - (std::fabs(track.tofNSigmaKa() - cfgMcTofShiftKa) < cfgCutNSig2 && track.p() > cfgCutKaP3))) { + std::fabs(track.tpcNSigmaKa()) < cfgCutNSig3 && + ((std::fabs(track.tofNSigmaKa()) < cfgCutNSig3 && track.p() <= cfgCutKaP3) || + (std::fabs(track.tofNSigmaKa()) < cfgCutNSig2 && track.p() > cfgCutKaP3))) { if (std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { return true; @@ -533,8 +606,8 @@ struct MeanPtFlucId { { if (track.hasTOF() && track.p() > cfgCutPrThrsldP && - std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig3 && - std::fabs(track.tofNSigmaPr() - cfgMcTofShiftPr) < cfgCutNSig3) { + std::fabs(track.tpcNSigmaPr()) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPr()) < cfgCutNSig3) { if (std::abs(track.rapidity(MassProton)) < cfgCutRap) { return true; @@ -545,7 +618,7 @@ struct MeanPtFlucId { } // To find the pT bin - int findBin(float pT, const std::vector& bins) + int findBin(float pT, const std::vector& bins) { for (size_t i = 0; i < bins.size() - 1; ++i) { if (pT >= bins[i] && pT < bins[i + 1]) { @@ -555,6 +628,30 @@ struct MeanPtFlucId { return -1; } + // Find bin index for both pT and eta + std::pair find2DBin(float pT, float eta, const std::vector& ptBins, const std::vector& etaBins) + { + int ptBin = -1, etaBin = -1; + + // Find pT bin + for (size_t i = 0; i < ptBins.size() - 1; ++i) { + if (pT >= ptBins[i] && pT < ptBins[i + 1]) { + ptBin = i + 1; // ROOT bins start from 1 + break; + } + } + + // Find eta bin + for (size_t j = 0; j < etaBins.size() - 1; ++j) { + if (eta >= etaBins[j] && eta < etaBins[j + 1]) { + etaBin = j + 1; + break; + } + } + + return {ptBin, etaBin}; + } + // Fill hist before selection cuts: template void fillBeforeQAHistos(T const& col, U const& tracks) @@ -572,65 +669,48 @@ struct MeanPtFlucId { hist.fill(HIST("QA/before/h_DcaZ"), track.dcaZ()); hist.fill(HIST("QA/before/h2_DcaXY"), track.pt(), track.dcaXY()); hist.fill(HIST("QA/before/h2_DcaZ"), track.pt(), track.dcaZ()); - if (track.hasTOF()) hist.fill(HIST("QA/before/h2_PtofvsPinner"), track.p(), track.tpcInnerParam()); } hist.fill(HIST("QA/before/h_VtxZ"), col.posZ()); hist.fill(HIST("QA/before/h_Counts"), 2); - - int nTPC = col.multNTracksHasTPC(); - int nFT0M = col.multFT0M(); - int nFT0C = col.multFT0C(); - double centFT0C = col.centFT0C(); - double centFT0M = col.centFT0M(); - - if (nTPC != 0 && nFT0M != 0) { - hist.fill(HIST("QA/before/h_NTPC"), nTPC); - hist.fill(HIST("QA/before/h_Cent"), centFT0C); - hist.fill(HIST("QA/before/h_CentM"), centFT0M); - hist.fill(HIST("QA/before/h_NFT0M"), nFT0M); - hist.fill(HIST("QA/before/h_NFT0C"), nFT0M); - hist.fill(HIST("QA/before/h2_NTPC_NFT0M"), nFT0M, nTPC); - hist.fill(HIST("QA/before/h2_NTPC_NFT0C"), nFT0C, nTPC); - hist.fill(HIST("QA/before/h2_NTPC_Cent"), centFT0C, nTPC); - } + hist.fill(HIST("QA/before/h_NTPC"), col.multNTracksHasTPC()); + hist.fill(HIST("QA/before/h_Cent"), col.centFT0C()); + hist.fill(HIST("QA/after/h_CentM"), col.centFT0M()); + hist.fill(HIST("QA/before/h_NFT0M"), col.multFT0M()); + hist.fill(HIST("QA/before/h_NFT0C"), col.multFT0M()); + hist.fill(HIST("QA/before/h2_NTPC_NFT0M"), col.multFT0M(), col.multNTracksHasTPC()); + hist.fill(HIST("QA/before/h2_NTPC_NFT0C"), col.multFT0C(), col.multNTracksHasTPC()); + hist.fill(HIST("QA/before/h2_NTPC_Cent"), col.centFT0C(), col.multNTracksHasTPC()); } // Fill hist after selection cuts: template void fillAfterQAHistos(T const& col) { - int nTPC = col.multNTracksHasTPC(); - int nFT0M = col.multFT0M(); - int nFT0C = col.multFT0C(); - double centFT0C = col.centFT0C(); - double centFT0M = col.centFT0M(); - hist.fill(HIST("QA/after/h_VtxZ"), col.posZ()); hist.fill(HIST("QA/after/h_Counts"), 2); - if (nTPC != 0 && nFT0M != 0) { - hist.fill(HIST("QA/after/h_NTPC"), nTPC); - hist.fill(HIST("QA/after/h_Cent"), centFT0C); - hist.fill(HIST("QA/after/h_CentM"), centFT0M); - hist.fill(HIST("QA/after/h_NFT0M"), nFT0M); - hist.fill(HIST("QA/after/h_NFT0C"), nFT0C); - hist.fill(HIST("QA/after/h2_NTPC_NFT0M"), nFT0M, nTPC); - hist.fill(HIST("QA/after/h2_NTPC_NFT0C"), nFT0C, nTPC); - hist.fill(HIST("QA/after/h2_NTPC_Cent"), centFT0C, nTPC); - hist.fill(HIST("QA/after/p_NTPC_Cent"), centFT0C, nTPC); - hist.fill(HIST("QA/after/p_NTPC_NFT0M"), nFT0M, nTPC); - hist.fill(HIST("QA/after/p_NTPC_NFT0C"), nFT0C, nTPC); - } + hist.fill(HIST("QA/after/h_NTPC"), col.multNTracksHasTPC()); + hist.fill(HIST("QA/after/h_Cent"), col.centFT0C()); + hist.fill(HIST("QA/after/h_CentM"), col.centFT0M()); + hist.fill(HIST("QA/after/h_NFT0M"), col.multFT0M()); + hist.fill(HIST("QA/after/h_NFT0C"), col.multFT0C()); + hist.fill(HIST("QA/after/h2_NTPC_NFT0M"), col.multFT0M(), col.multNTracksHasTPC()); + hist.fill(HIST("QA/after/h2_NTPC_NFT0C"), col.multFT0C(), col.multNTracksHasTPC()); + hist.fill(HIST("QA/after/h2_NTPC_Cent"), col.centFT0C(), col.multNTracksHasTPC()); + hist.fill(HIST("QA/after/p_NTPC_Cent"), col.centFT0C(), col.multNTracksHasTPC()); + hist.fill(HIST("QA/after/p_NTPC_NFT0M"), col.multFT0M(), col.multNTracksHasTPC()); + hist.fill(HIST("QA/after/p_NTPC_NFT0C"), col.multFT0C(), col.multNTracksHasTPC()); } // Fill Charged particles QA: template - void fillChargedQAHistos(T const& track) + void fillChargedQAHistos(T const& track, int nFT0M) { hist.fill(HIST("QA/after/h_Eta"), track.eta()); hist.fill(HIST("QA/after/h_Phi"), track.phi()); hist.fill(HIST("QA/after/h_Pt"), track.pt()); + hist.fill(HIST("QA/after/h2_Pt_NFT0M"), track.pt(), nFT0M); hist.fill(HIST("QA/after/h2_PvsPinner"), track.p(), track.tpcInnerParam()); hist.fill(HIST("QA/after/h2_Pt_Eta"), track.eta(), track.pt()); hist.fill(HIST("QA/after/h_DcaZ"), track.dcaZ()); @@ -690,34 +770,60 @@ struct MeanPtFlucId { // Fill after PID cut QA hist: template - void fillIdParticleQAHistos(T const& track, std::vector effBins, std::vector effValues, double rap, double nSigmaTPC, double nSigmaTOF, int& N, double& Q1, double& Q2, double& Q3, double& Q4) + void fillIdParticleQAHistos(T const& track, const std::vector& ptBins, const std::vector& etaBins, const std::vector& effPtValues, const std::vector& effPtEtaValues, double rap, double nSigmaTPC, double nSigmaTOF, int nFT0M, int& N, double& Q1, double& Q2, double& Q3, double& Q4) { double pt = track.pt(); + double eta = track.eta(); - if (cfgCorrection == true) { - int binIndex = findBin(pt, effBins); - auto effVal = static_cast>(effValues); + if (cfgCorrectionPtEta) { + auto [ptBin, etaBin] = find2DBin(pt, eta, ptBins, etaBins); + auto effPtEtaVal = static_cast>(effPtEtaValues); + + if (ptBin != -1 && etaBin != -1) { + int numPtBins = ptBins.size() - 1; // Number of pt bins + float efficiency = effPtEtaVal[etaBin * numPtBins + ptBin]; + + if (efficiency > 0) { + float weight = 1.0 / efficiency; + N += weight; + hist.fill(HIST(Dire[Mode]) + HIST("h2_Pt_Eta_weighted"), eta, pt, weight); + } + } + } else if (cfgCorrection) { + int binIndex = findBin(pt, ptBins); + auto effVal = static_cast>(effPtValues); if (binIndex != -1) { float efficiency = effVal[binIndex]; if (efficiency > 0) { float weight = 1.0 / efficiency; - N += static_cast(weight); - double ptCorrected = pt * weight; - moments(ptCorrected, Q1, Q2, Q3, Q4); - hist.fill(HIST(Dire[Mode]) + HIST("h_pt_weighted"), pt, weight); + N += weight; // Correct denominator correction + hist.fill(HIST(Dire[Mode]) + HIST("h_Pt_weighted"), pt, weight); } } } else { - N++; - moments(pt, Q1, Q2, Q3, Q4); + N++; // No correction applied } + moments(pt, Q1, Q2, Q3, Q4); + hist.fill(HIST(Dire[Mode]) + HIST("h_Pt"), track.pt()); - if (track.sign() > 0) + hist.fill(HIST(Dire[Mode]) + HIST("h_Eta"), track.eta()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_Pt_NFT0M"), track.pt(), nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h2_Pt_Eta"), track.eta(), track.pt()); + if (track.sign() > 0) { hist.fill(HIST(Dire[Mode]) + HIST("h_PtPos"), track.pt()); - - if (track.sign() < 0) + hist.fill(HIST(Dire[Mode]) + HIST("h_EtaPos"), track.eta()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtPos_NFT0M"), track.pt(), nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtPos_Eta"), track.eta(), track.pt()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtPos_rap"), rap, track.pt()); + } + if (track.sign() < 0) { hist.fill(HIST(Dire[Mode]) + HIST("h_PtNeg"), track.pt()); + hist.fill(HIST(Dire[Mode]) + HIST("h_EtaNeg"), track.eta()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtNeg_NFT0M"), track.pt(), nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtNeg_Eta"), track.eta(), track.pt()); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtNeg_rap"), rap, track.pt()); + } hist.fill(HIST(Dire[Mode]) + HIST("h_Eta"), track.eta()); hist.fill(HIST(Dire[Mode]) + HIST("h_Phi"), track.phi()); @@ -756,14 +862,27 @@ struct MeanPtFlucId { } template - void fillPtMCHist(double pt, int pid, int pdgCodePos, int pdgCodeNeg) + void fillPtMCHist(double pt, double eta, double rap, int nFT0M, int pid, int pdgCodePos, int pdgCodeNeg) { hist.fill(HIST(Dire[Mode]) + HIST("h_PtTruth"), pt); + hist.fill(HIST(Dire[Mode]) + HIST("h_EtaTruth"), eta); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtTruth_NFT0M"), pt, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtTruth_Eta"), eta, pt); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtTruth_Rap"), rap, pt); + if (pid == pdgCodePos) { hist.fill(HIST(Dire[Mode]) + HIST("h_PtPosTruth"), pt); + hist.fill(HIST(Dire[Mode]) + HIST("h_EtaPosTruth"), eta); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtPosTruth_NFT0M"), pt, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtPosTruth_Eta"), eta, pt); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtPosTruth_Rap"), rap, pt); } if (pid == pdgCodeNeg) { hist.fill(HIST(Dire[Mode]) + HIST("h_PtNegTruth"), pt); + hist.fill(HIST(Dire[Mode]) + HIST("h_EtaNegTruth"), eta); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtNegTruth_NFT0M"), pt, nFT0M); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtNegTruth_Eta"), eta, pt); + hist.fill(HIST(Dire[Mode]) + HIST("h2_PtNegTruth_Rap"), rap, pt); } } @@ -822,15 +941,17 @@ struct MeanPtFlucId { template void fillHistos(T const& col, U const& tracks) { - int nCh = 0, nTPC = 0, nFT0M = 0; + int nCh = 0, nTPC = 0, nFT0M = 0, nFT0C = 0; + int nPi = 0, nKa = 0, nPr = 0; double ptCh = 0, q1Ch = 0, q2Ch = 0, q3Ch = 0, q4Ch = 0; double ptPi = 0, q1Pi = 0, q2Pi = 0, q3Pi = 0, q4Pi = 0; double ptPr = 0, q1Pr = 0, q2Pr = 0, q3Pr = 0, q4Pr = 0; double ptKa = 0, q1Ka = 0, q2Ka = 0, q3Ka = 0, q4Ka = 0; - int nChSim = 0, nSim = 0, NFT0CSim = 0; + int nChSim = 0, nSim = 0, nFT0CSim = 0; int nPiSim = 0, nKaSim = 0, nPrSim = 0; + double eta = 0, etaSim = 0, rapSim = 0; double ptChSim = 0, q1ChSim = 0, q2ChSim = 0, q3ChSim = 0, q4ChSim = 0; double ptPiSim = 0, q1PiSim = 0, q2PiSim = 0, q3PiSim = 0, q4PiSim = 0; double ptPrSim = 0, q1PrSim = 0, q2PrSim = 0, q3PrSim = 0, q4PrSim = 0; @@ -856,7 +977,13 @@ struct MeanPtFlucId { hist.fill(HIST("QA/after/h_invMass_gamma"), invMassGamma); } + fillAfterQAHistos(col); + if constexpr (DataFlag) { + nTPC = col.multNTracksHasTPC(); + nFT0M = col.multFT0M(); + nFT0C = col.multFT0C(); + for (const auto& track : tracks) { if (!selTrack(track)) { continue; @@ -871,28 +998,26 @@ struct MeanPtFlucId { double rapPi = track.rapidity(MassPiPlus); double rapKa = track.rapidity(MassKPlus); double rapPr = track.rapidity(MassProton); - double innerParam = track.tpcInnerParam(); if (std::fabs(track.eta()) < 0.8) { ptCh = track.pt(); if (cfgCorrection == true) { - int binIndex = findBin(ptCh, effBinsCh); + int binIndex = findBin(ptCh, ptBins); auto effValCh = static_cast>(effValuesCh); if (binIndex != -1) { float efficiency = effValCh[binIndex]; if (efficiency > 0) { float weight = 1.0 / efficiency; - nCh += static_cast(weight); - double ptChCorrected = ptCh * weight; - moments(ptChCorrected, q1Ch, q2Ch, q3Ch, q4Ch); - hist.fill(HIST("QA/after/h_pt_weighted"), ptCh, weight); + nCh += weight; // Correct denominator correction + hist.fill(HIST("QA/after/h_Pt_weighted"), ptCh, weight); } } } else { nCh++; - moments(ptCh, q1Ch, q2Ch, q3Ch, q4Ch); } - fillChargedQAHistos(track); + moments(ptCh, q1Ch, q2Ch, q3Ch, q4Ch); + + fillChargedQAHistos(track, nFT0M); } fillBeforePIDQAHistos(track); @@ -906,32 +1031,32 @@ struct MeanPtFlucId { } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowPi(track, innerParam) == cfgSelLow || selHighPi(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + if (selLowPi(track) == cfgSelLow || selHighPi(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPi, effPtEtaValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowPi(track, innerParam) == cfgSelLow && selHighPi(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + if (selLowPi(track) == cfgSelLow && selHighPi(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPi, effPtEtaValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); } } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowKa(track, innerParam) == cfgSelLow || selHighKa(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + if (selLowKa(track) == cfgSelLow || selHighKa(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesKa, effPtEtaValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowKa(track, innerParam) == cfgSelLow && selHighKa(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + if (selLowKa(track) == cfgSelLow && selHighKa(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesKa, effPtEtaValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); } } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowPr(track, innerParam) == cfgSelLow && selHighPr(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + if (selLowPr(track) == cfgSelLow || selHighPr(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPr, effPtEtaValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowPr(track, innerParam) == cfgSelLow && selHighPr(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + if (selLowPr(track) == cfgSelLow && selHighPr(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPr, effPtEtaValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); } } } @@ -940,6 +1065,9 @@ struct MeanPtFlucId { LOGF(warning, "No MC collision for this collision, skip..."); return; } + nTPC = col.multNTracksHasTPC(); + nFT0M = col.multFT0M(); + nFT0C = col.multFT0C(); for (const auto& track : tracks) { if (!track.has_mcParticle()) { @@ -952,6 +1080,10 @@ struct MeanPtFlucId { continue; } + if (std::abs(track.eta()) < 0.8) { + nTPC++; + } + //______________________________Reconstructed Level____________________________________________________// if (selTrack(track)) { @@ -964,29 +1096,25 @@ struct MeanPtFlucId { double rapPi = track.rapidity(MassPiPlus); double rapKa = track.rapidity(MassKPlus); double rapPr = track.rapidity(MassProton); - double innerParam = track.tpcInnerParam(); if (std::fabs(track.eta()) < 0.8) { - nCh++; ptCh = track.pt(); if (cfgCorrection == true) { - int binIndex = findBin(ptCh, effBinsCh); + int binIndex = findBin(ptCh, ptBins); auto effValCh = static_cast>(effValuesCh); if (binIndex != -1) { float efficiency = effValCh[binIndex]; if (efficiency > 0) { float weight = 1.0 / efficiency; - nCh += static_cast(weight); - double ptChCorrected = ptCh * weight; - moments(ptChCorrected, q1Ch, q2Ch, q3Ch, q4Ch); - hist.fill(HIST("QA/after/h_pt_weighted"), ptCh, weight); + nCh += weight; // Correct denominator correction + hist.fill(HIST("QA/after/h_Pt_weighted"), ptCh, weight); } } } else { nCh++; - moments(ptCh, q1Ch, q2Ch, q3Ch, q4Ch); } - fillChargedQAHistos(track); + moments(ptCh, q1Ch, q2Ch, q3Ch, q4Ch); + fillChargedQAHistos(track, nFT0M); } fillBeforePIDQAHistos(track); @@ -998,77 +1126,78 @@ struct MeanPtFlucId { continue; } + eta = track.eta(); if (cfgPDGCodeOnly == true) { if (std::abs(pid) == kPiPlus && std::abs(rapPi) < 0.5 && track.pt() >= cfgCutPiPtMin) { ptPi = track.pt(); - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); - fillPtMCHist(ptPi, pid, kPiPlus, kPiMinus); + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPi, effPtEtaValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + fillPtMCHist(ptPi, eta, rapPi, nFT0M, pid, kPiPlus, kPiMinus); } if (std::abs(pid) == kKPlus && std::abs(rapKa) < 0.5 && track.pt() >= cfgCutKaPtMin) { ptKa = track.pt(); - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); - fillPtMCHist(ptKa, pid, kKPlus, kKMinus); + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesKa, effPtEtaValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + fillPtMCHist(ptKa, eta, rapKa, nFT0M, pid, kKPlus, kKMinus); } if (std::abs(pid) == kProton && std::abs(rapPr) < 0.5 && track.pt() >= cfgCutPrPtMin) { ptPr = track.pt(); - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); - fillPtMCHist(ptPr, pid, kProton, kProtonBar); + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPr, effPtEtaValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + fillPtMCHist(ptPr, eta, rapPr, nFT0M, pid, kProton, kProtonBar); } } if (cfgPidCut == true) { if (cfgSelOR == true && cfgSelAND == false) { - if (selLowPi(track, innerParam) == cfgSelLow || selHighPi(track) == cfgSelHigh) { + if (selLowPi(track) == cfgSelLow || selHighPi(track) == cfgSelHigh) { ptPi = track.pt(); - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPi, effPtEtaValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); if (std::abs(pid) == kPiPlus) { - fillPtMCHist(ptPi, pid, kPiPlus, kPiMinus); + fillPtMCHist(ptPi, eta, rapPi, nFT0M, pid, kPiPlus, kPiMinus); } } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowPi(track, innerParam) == cfgSelLow && selHighPi(track) == cfgSelHigh) { + if (selLowPi(track) == cfgSelLow && selHighPi(track) == cfgSelHigh) { ptPi = track.pt(); - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPi, effPtEtaValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); if (std::abs(pid) == kPiPlus) { - fillPtMCHist(ptPi, pid, kPiPlus, kPiMinus); + fillPtMCHist(ptPi, eta, rapPi, nFT0M, pid, kPiPlus, kPiMinus); } } } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowKa(track, innerParam) == cfgSelLow || selHighKa(track) == cfgSelHigh) { + if (selLowKa(track) == cfgSelLow || selHighKa(track) == cfgSelHigh) { ptKa = track.pt(); - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesKa, effPtEtaValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); if (std::abs(pid) == kKPlus) { - fillPtMCHist(ptKa, pid, kKPlus, kKMinus); + fillPtMCHist(ptKa, eta, rapKa, nFT0M, pid, kKPlus, kKMinus); } } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowKa(track, innerParam) == cfgSelLow && selHighKa(track) == cfgSelHigh) { + if (selLowKa(track) == cfgSelLow && selHighKa(track) == cfgSelHigh) { ptKa = track.pt(); - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesKa, effPtEtaValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); if (std::abs(pid) == kKPlus) { - fillPtMCHist(ptKa, pid, kKPlus, kKMinus); + fillPtMCHist(ptKa, eta, rapKa, nFT0M, pid, kKPlus, kKMinus); } } } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowPr(track, innerParam) == cfgSelLow || selHighPr(track) == cfgSelHigh) { + if (selLowPr(track) == cfgSelLow || selHighPr(track) == cfgSelHigh) { ptPr = track.pt(); - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPr, effPtEtaValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); if (std::abs(pid) == kProton) { - fillPtMCHist(ptPr, pid, kProton, kProtonBar); + fillPtMCHist(ptPr, eta, rapPr, nFT0M, pid, kProton, kProtonBar); } } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowPr(track, innerParam) == cfgSelLow && selHighPr(track) == cfgSelHigh) { + if (selLowPr(track) == cfgSelLow && selHighPr(track) == cfgSelHigh) { ptPr = track.pt(); - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + fillIdParticleQAHistos(track, ptBins, etaBins, effPtValuesPr, effPtEtaValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); if (std::abs(pid) == kProton) { - fillPtMCHist(ptPr, pid, kProton, kProtonBar); + fillPtMCHist(ptPr, eta, rapPr, nFT0M, pid, kProton, kProtonBar); } } } @@ -1084,41 +1213,49 @@ struct MeanPtFlucId { if (std::fabs(charge) < 1e-3) { continue; } - if (std::abs(mcPart.eta()) < 0.8) { + 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()) < 0.8) { nSim++; } - if (-3.3 < mcPart.eta() && mcPart.eta() < -2.1) { - NFT0CSim++; + + if (mcPart.eta() > -3.3 || mcPart.eta() < -2.1) { + nFT0CSim++; } if (mcPart.pt() > cfgCutPtMin && mcPart.pt() < cfgCutPtMax) { - if (std::abs(mcPart.eta()) > 0.8) { - continue; + if (std::abs(mcPart.eta()) < 0.8) { + nChSim++; + ptChSim = mcPart.pt(); + moments(ptChSim, q1ChSim, q2ChSim, q3ChSim, q4ChSim); + hist.fill(HIST("Gen/Charged/h_PtTruth"), mcPart.pt()); + hist.fill(HIST("Gen/Charged/h2_PtTruth_NFT0M"), mcPart.pt(), nFT0M); } - nChSim++; - ptChSim = mcPart.pt(); - moments(ptChSim, q1ChSim, q2ChSim, q3ChSim, q4ChSim); - hist.fill(HIST("Gen/Charged/h_PtTruth"), mcPart.pt()); if (std::abs(mcPart.y()) > cfgCutRap) { continue; } if (std::abs(pid) == kPiPlus && mcPart.pt() >= cfgCutPiPtMin) { + etaSim = mcPart.eta(); + rapSim = mcPart.y(); + if (cfgSelOR == true && cfgSelAND == false) { if (mcPart.p() <= cfgCutPiThrsldP || mcPart.p() > cfgCutPiThrsldP) { nPiSim++; ptPiSim = mcPart.pt(); moments(ptPiSim, q1PiSim, q2PiSim, q3PiSim, q4PiSim); - fillPtMCHist(ptPiSim, pid, kPiPlus, kPiMinus); + fillPtMCHist(ptPiSim, etaSim, rapSim, nFT0M, pid, kPiPlus, kPiMinus); } } else if (cfgSelOR == false && cfgSelAND == true) { if ((cfgSelLow == true && mcPart.p() <= cfgCutPiThrsldP) && (cfgSelHigh == true && mcPart.p() > cfgCutPiThrsldP)) { nPiSim++; ptPiSim = mcPart.pt(); moments(ptPiSim, q1PiSim, q2PiSim, q3PiSim, q4PiSim); - fillPtMCHist(ptPiSim, pid, kPiPlus, kPiMinus); + fillPtMCHist(ptPiSim, etaSim, rapSim, nFT0M, pid, kPiPlus, kPiMinus); } } } @@ -1129,14 +1266,14 @@ struct MeanPtFlucId { nKaSim++; ptKaSim = mcPart.pt(); moments(ptKaSim, q1KaSim, q2KaSim, q3KaSim, q4KaSim); - fillPtMCHist(ptKaSim, pid, kKPlus, kKMinus); + fillPtMCHist(ptKaSim, etaSim, rapSim, nFT0M, pid, kKPlus, kKMinus); } } else if (cfgSelOR == false && cfgSelAND == true) { if ((cfgSelLow == true && mcPart.p() <= cfgCutKaThrsldP) && (cfgSelHigh == true && mcPart.p() > cfgCutKaThrsldP)) { nKaSim++; ptKaSim = mcPart.pt(); moments(ptKaSim, q1KaSim, q2KaSim, q3KaSim, q4KaSim); - fillPtMCHist(ptKaSim, pid, kKPlus, kKMinus); + fillPtMCHist(ptKaSim, etaSim, rapSim, nFT0M, pid, kKPlus, kKMinus); } } } @@ -1147,44 +1284,89 @@ struct MeanPtFlucId { nPrSim++; ptPrSim = mcPart.pt(); moments(ptPrSim, q1PrSim, q2PrSim, q3PrSim, q4PrSim); - fillPtMCHist(ptPrSim, pid, kProton, kProtonBar); + fillPtMCHist(ptPrSim, etaSim, rapSim, nFT0M, pid, kProton, kProtonBar); } } else if (cfgSelOR == false && cfgSelAND == true) { if ((cfgSelLow == true && mcPart.p() <= cfgCutPrThrsldP) && (cfgSelHigh == true && mcPart.p() > cfgCutPrThrsldP)) { nPrSim++; ptPrSim = mcPart.pt(); moments(ptPrSim, q1PrSim, q2PrSim, q3PrSim, q4PrSim); - fillPtMCHist(ptPrSim, pid, kProton, kProtonBar); + fillPtMCHist(ptPrSim, etaSim, rapSim, nFT0M, pid, kProton, kProtonBar); } } } } } + + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + LOGF(warning, "No MC Particle for this track, skip..."); + continue; + } + auto mcPart = track.mcParticle(); + int pid = mcPart.pdgCode(); + if (!mcPart.isPhysicalPrimary()) { + continue; + } + + if (selTrack(track)) { + if (std::abs(track.eta()) < 0.8) { + double pt = track.pt(); + if (cfgCorrection == true) { + int binIndex = findBin(pt, ptBins); + auto effValCh = static_cast>(effValuesCh); + if (binIndex != -1) { + float efficiency = effValCh[binIndex]; + if (efficiency > 0) { + float weight = 1.0 / efficiency; + hist.fill(HIST("QA/after/h2_pt_nch"), nCh, pt, weight); + } + } + } + } + } + + auto charge = 0.; + auto* pd = pdg->GetParticle(pid); + if (pd != nullptr) { + charge = pd->Charge(); + } + if (std::fabs(charge) < 1e-3) { + continue; + } + if (std::abs(pid) != kElectron && std::abs(pid) != kMuonMinus && std::abs(pid) != kPiPlus && std::abs(pid) != kKPlus && std::abs(pid) != kProton) { + continue; + } + if (mcPart.pt() > cfgCutPtMin && mcPart.pt() < cfgCutPtMax) { + if (std::abs(mcPart.eta()) < 0.8) { + double pt = mcPart.pt(); + hist.fill(HIST("Gen/h2_pt_nch"), nChSim, pt); + } + } + } hist.fill(HIST("QA/after/h_vtxZSim"), col.mcCollision().posZ()); } - nTPC = col.multNTracksHasTPC(); - nFT0M = col.multFT0M(); + if (nTPC > 0 && nCh > 0) + hist.fill(HIST("QA/after/h2_NTPC_NCh"), nTPC, nCh); if (cfgMCTruth) { - if (nSim != 0) + if (nSim > 0) hist.fill(HIST("QA/after/h_NSim"), nSim); - if (nSim != 0 && nChSim != 0) + if (nSim > 0 && nChSim > 0) hist.fill(HIST("QA/after/h2_NChSim_NSim"), nSim, nChSim); - if (nSim != 0 && nTPC != 0) + if (nSim > 0 && nTPC > 0) hist.fill(HIST("QA/after/h2_NTPC_NSim"), nSim, nTPC); - int nFT0C = col.multFT0C(); - if (nFT0C != 0 && NFT0CSim != 0) - hist.fill(HIST("QA/after/h2_NFT0C_NFT0CSim"), NFT0CSim, nFT0C); - - nTPC = nSim; - hist.fill(HIST("Gen/NTPC"), nTPC); - hist.fill(HIST("Gen/NFT0C"), NFT0CSim); - hist.fill(HIST("Gen/h2_NTPC_NFT0C"), NFT0CSim, nTPC); + hist.fill(HIST("Gen/NFT0C"), nFT0CSim); + hist.fill(HIST("Gen/h2_NTPC_NFT0C"), nFT0CSim, nTPC); + hist.fill(HIST("Gen/h2_NTPC_NFT0M"), nFT0M, nTPC); + + if (nFT0C != 0 && nFT0CSim != 0) + hist.fill(HIST("QA/after/h2_NFT0C_NFT0CSim"), nFT0CSim, nFT0C); fillAnalysisHistos(nTPC, nFT0M, nChSim, q1ChSim, q2ChSim, q3ChSim, q4ChSim); fillAnalysisHistos(nTPC, nFT0M, nPiSim, q1PiSim, q2PiSim, q3PiSim, q4PiSim); @@ -1192,17 +1374,13 @@ struct MeanPtFlucId { fillAnalysisHistos(nTPC, nFT0M, nPrSim, q1PrSim, q2PrSim, q3PrSim, q4PrSim); } - fillAfterQAHistos(col); - if (nTPC != 0 && nCh != 0) - hist.fill(HIST("QA/after/h2_NTPC_NCh"), nTPC, nCh); - fillAnalysisHistos(nTPC, nFT0M, nCh, q1Ch, q2Ch, q3Ch, q4Ch); fillAnalysisHistos(nTPC, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); fillAnalysisHistos(nTPC, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); fillAnalysisHistos(nTPC, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); } - void processRun3(MyCollisions::iterator const& col, MyAllTracks const& tracks) + void processRun3(MyRun3Collisions::iterator const& col, MyAllTracks const& tracks) { // Before Collision and Track Cuts: fillBeforeQAHistos(col, tracks); @@ -1212,9 +1390,9 @@ struct MeanPtFlucId { fillHistos(col, tracks); } } - PROCESS_SWITCH(MeanPtFlucId, processRun3, "Process for Run3", false); + PROCESS_SWITCH(MeanPtFlucId, processRun3, "Process for Run-3", false); - void processMCRecoSimRun3(MyMCCollisions::iterator const& col, aod::McCollisions const&, MyMCTracks const& tracks, aod::McParticles const&) + void processMCRecoSimRun3(MyRun3MCCollisions::iterator const& col, aod::McCollisions const&, MyMCTracks const& tracks, aod::McParticles const&) { // Before Collision and Track Cuts: fillBeforeQAHistos(col, tracks);