@@ -3748,8 +3748,8 @@ struct PidFlowPtCorr {
37483748 PROCESS_SWITCH (PidFlowPtCorr, processMCClosure, " Run truth-level MC flow closure" , false );
37493749
37503750 /* *
3751- * @brief this function is used to fill THn hist for NUA correction and for NUE correction
3752- * @details hist THn: (runNumberIDX, phi, eta, Vz), note that different runNumber will be put in the same hist
3751+ * @brief Fill THnSparse histograms used to derive NUA weights
3752+ * @details Histograms use (runNumberIDX, phi, eta, Vz, pT); cfgUseNUAWithPt enables NUE weighting before filling
37533753 *
37543754 * @param collision
37553755 * @param tracks
@@ -3780,6 +3780,10 @@ struct PidFlowPtCorr {
37803780 }
37813781 // end collision cut
37823782
3783+ if (switchsOpts.cfgUseNUAWithPt .value ) {
3784+ loadCorrections (bc.timestamp ());
3785+ }
3786+
37833787 // loop the vector, find the place to put (phi eta Vz)
37843788 // if the run number is new, create one
37853789 int matchedPosition = -1 ;
@@ -3816,24 +3820,32 @@ struct PidFlowPtCorr {
38163820
38173821 // fill the THn
38183822 if (isWithinRefPtRange (track.pt ())) {
3819- registry.fill (HIST (" correction/hRunNumberPhiEtaVertex" ), matchedPosition, track.phi (), track.eta (), collision.posZ (), track.pt ());
3823+ float weightNUE = 1 .f ;
3824+ if (switchsOpts.cfgUseNUAWithPt .value ) {
3825+ setParticleNUEWeight (weightNUE, track, cent);
3826+ }
3827+ registry.fill (HIST (" correction/hRunNumberPhiEtaVertex" ), matchedPosition, track.phi (), track.eta (), collision.posZ (), track.pt (), weightNUE);
38203828 }
38213829
38223830 int pid = this ->getPidConfigurable (track);
38233831 if (!isWithinPOIPtRange (pid, track.pt ())) {
38243832 continue ;
38253833 }
3834+ float weightNUEPid = 1 .f ;
3835+ if (switchsOpts.cfgUseNUAWithPt .value ) {
3836+ setParticleNUEWeight (weightNUEPid, track, cent, pid);
3837+ }
38263838 switch (pid) {
38273839 case MyParticleType::kPion :
3828- registry.fill (HIST (" correction/hRunNumberPhiEtaVertexPion" ), matchedPosition, track.phi (), track.eta (), collision.posZ (), track.pt ());
3840+ registry.fill (HIST (" correction/hRunNumberPhiEtaVertexPion" ), matchedPosition, track.phi (), track.eta (), collision.posZ (), track.pt (), weightNUEPid );
38293841 break ;
38303842
38313843 case MyParticleType::kKaon :
3832- registry.fill (HIST (" correction/hRunNumberPhiEtaVertexKaon" ), matchedPosition, track.phi (), track.eta (), collision.posZ (), track.pt ());
3844+ registry.fill (HIST (" correction/hRunNumberPhiEtaVertexKaon" ), matchedPosition, track.phi (), track.eta (), collision.posZ (), track.pt (), weightNUEPid );
38333845 break ;
38343846
38353847 case MyParticleType::kProton :
3836- registry.fill (HIST (" correction/hRunNumberPhiEtaVertexProton" ), matchedPosition, track.phi (), track.eta (), collision.posZ (), track.pt ());
3848+ registry.fill (HIST (" correction/hRunNumberPhiEtaVertexProton" ), matchedPosition, track.phi (), track.eta (), collision.posZ (), track.pt (), weightNUEPid );
38373849 break ;
38383850
38393851 default :
0 commit comments