3030#include " Framework/RunningWorkflowInfo.h"
3131#include " Framework/runDataProcessing.h"
3232#include " ReconstructionDataFormats/V0.h"
33+ #include " CommonConstants/MathConstants.h"
3334
3435#include < TFile.h>
3536#include < THn.h>
3637
3738#include < experimental/type_traits>
3839#include < string>
40+ #include < vector>
3941
4042using namespace o2 ;
4143using namespace o2 ::framework;
@@ -243,7 +245,7 @@ struct JflucWeightsLoader {
243245 {
244246 loadWeights (output, collision, tracks);
245247 }
246- PROCESS_SWITCH (JflucWeightsLoader, processLoadWeightsCF, " Load weights histograms for CF derived data table" , true );
248+ PROCESS_SWITCH (JflucWeightsLoader, processLoadWeightsCF, " Load weights histograms for CF derived data table" , false );
247249
248250 Produces<aod::J2ProngWeights> output2p;
249251 void processLoadWeightsCF2Prong (aod::CFCollision const & collision, aod::CF2ProngTracks const & tracks2p)
@@ -253,7 +255,66 @@ struct JflucWeightsLoader {
253255 PROCESS_SWITCH (JflucWeightsLoader, processLoadWeightsCF2Prong, " Load weights histograms for CF derived 2-prong tracks data table" , false );
254256};
255257
258+ struct JNUACreator {
259+
260+ O2_DEFINE_CONFIGURABLE (cfgPtMin, float , 0 .2f , " Minimum pT used for track selection." );
261+ O2_DEFINE_CONFIGURABLE (cfgPtMax, float , 5 .0f , " Maximum pT used for track selection." );
262+ O2_DEFINE_CONFIGURABLE (cfgEtaMax, float , 1 .0f , " Maximum eta used for track selection." );
263+ O2_DEFINE_CONFIGURABLE (cfgMinMultiplicity, int , 5 , " Minimum number of particles required for the event to have." );
264+ O2_DEFINE_CONFIGURABLE (cfgTrackBitMask, uint16_t , 0 , " Track selection bitmask to use as defined in the filterCorrelations.cxx task" );
265+
266+ ConfigurableAxis cfgAxisMultiplicity{" axisMultiplicity" , {VARIABLE_WIDTH, 0 , 2.0 , 5 , 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 100.1 }, " multiplicity / centrality axis for histograms" };
267+ ConfigurableAxis cfgAxisPhi{" axisPhi" , {50 , 0.0 , o2::constants::math::TwoPI}, " phi axis for histograms" };
268+ ConfigurableAxis cfgAxisEta{" axisEta" , {40 , -2.0 , 2.0 }, " eta axis for histograms" };
269+ ConfigurableAxis cfgAxisZVertex{" axisZVertex" , {20 , -10.0 , 10.0 }, " zvertex axis for histograms" };
270+
271+
272+ // we read cffilter collisions and tracks -- zvtx, ptMin, eta, multiplicity, trackSelection cuts and bits
273+ // come from the PWGCF/TableProducer/filterCorrelations.cxx task
274+
275+ HistogramRegistry qaHistRegistry{" qaHistRegistry" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
276+
277+ void init (InitContext const &)
278+ {
279+ qaHistRegistry.add (" trackType" , " trackType;trackType;counts" , HistType::kTH1F , {{65 , -0.5 , 64.5 }});
280+ // NUA histogram structure matches loader: THnF with axes (mult, partType, phi, eta, z) - same order as GetBin(nuaCoords) in loader
281+ const AxisSpec axisMult{cfgAxisMultiplicity, " multiplicity/centrality" };
282+ const AxisSpec axisType{2 , -0.5 , 1.5 , " type" }; // 0 = all charged hadrons (matches loader partType)
283+ const AxisSpec axisPhi{cfgAxisPhi, " #varphi" };
284+ const AxisSpec axisEta{cfgAxisEta, " #eta" };
285+ const AxisSpec axisZVertex{cfgAxisZVertex, " z_{vtx} [cm]" };
286+
287+ qaHistRegistry.add (" NUACreation/h_phietaz" , " (NUA) mult, type, phi, eta, z" , HistType::kTHnF , {axisMult, axisType, axisPhi, axisEta, axisZVertex});
288+ }
289+
290+ Filter derivedTracks = (nabs(aod::cftrack::eta) < cfgEtaMax) && (aod::cftrack::pt > cfgPtMin) && (aod::cftrack::pt < cfgPtMax) && ncheckbit(aod::track::trackType, as<uint8_t >(cfgTrackBitMask));
291+
292+ void processNUACreationCFDerived (aod::CFCollision const & collision, soa::Filtered<aod::CFTracks> const & tracks) {
293+
294+ if (tracks.size () < cfgMinMultiplicity) {
295+ return ; // reject if not enough tracks
296+ }
297+
298+ const auto multiplicity = collision.multiplicity (); // this comes from the filterCorrelations.cxx task
299+ if (multiplicity < 0 . || multiplicity > 100.1 ) {
300+ return ; // match upper edge of cfgAxisMultiplicity (100.1)
301+ }
302+
303+ const float posZ = collision.posZ ();
304+ // Fill NUA histogram with same coordinate order as loader: (mult, partType, phi, eta, z)
305+ // partType = 0 for all charged hadrons (matches loader where partType is always 0 for now)
306+ for (auto & track : tracks) {
307+ qaHistRegistry.fill (HIST (" NUACreation/h_phietaz" ), multiplicity, 0 .0f , track.phi (), track.eta (), posZ);
308+ qaHistRegistry.fill (HIST (" trackType" ), track.trackType ());
309+ }
310+ }
311+
312+ PROCESS_SWITCH (JNUACreator, processNUACreationCFDerived, " Create NUA histograms from CF derived data" , false );
313+ };
314+
256315WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
257316{
258- return WorkflowSpec{adaptAnalysisTask<JflucWeightsLoader>(cfgc)};
317+ return WorkflowSpec{
318+ adaptAnalysisTask<JflucWeightsLoader>(cfgc),
319+ adaptAnalysisTask<JNUACreator>(cfgc)};
259320}
0 commit comments