5252
5353#include " PWGLF/DataModel/LFSlimNucleiTables.h"
5454
55+ #include " TRandom3.h"
56+
5557using namespace o2 ;
5658using namespace o2 ::framework;
5759using namespace o2 ::framework::expressions;
@@ -117,6 +119,12 @@ constexpr int TreeConfigDefault[5][2]{
117119 {0 , 0 },
118120 {0 , 0 },
119121 {0 , 0 }};
122+ constexpr double DownscalingDefault[5 ][1 ]{
123+ {1 .},
124+ {1 .},
125+ {1 .},
126+ {1 .},
127+ {1 .}};
120128// constexpr bool storeTreesDefault[5]{false, false, false, false, false};
121129constexpr int species{5 };
122130constexpr int codes[5 ]{2212 , 1000010020 , 1000010030 , 1000020030 , 1000020040 };
@@ -128,6 +136,7 @@ static const std::vector<std::string> names{"proton", "deuteron", "triton", "He3
128136static const std::vector<std::string> treeConfigNames{" Filter trees" , " Use TOF selection" };
129137static const std::vector<std::string> nSigmaConfigName{" nsigma_min" , " nsigma_max" };
130138static const std::vector<std::string> nDCAConfigName{" max DCAxy" , " max DCAz" };
139+ static const std::vector<std::string> DownscalingConfigName{" Fraction of kept candidates" };
131140static const std::vector<std::string> betheBlochParNames{" p0" , " p1" , " p2" , " p3" , " p4" , " resolution" };
132141static const std::vector<std::string> binnedVariableNames{" DCAxy" , " DCAz" , " TPCnsigma" , " TOFnsigma" , " TOFmass" };
133142static const std::vector<std::string> chargeLabelNames{" Positive" , " Negative" };
@@ -194,6 +203,7 @@ struct nucleiSpectra {
194203 Configurable<LabeledArray<double >> cfgBetheBlochParams{" cfgBetheBlochParams" , {nuclei::betheBlochDefault[0 ], 5 , 6 , nuclei::names, nuclei::betheBlochParNames}, " TPC Bethe-Bloch parameterisation for light nuclei" };
195204 Configurable<LabeledArray<double >> cfgNsigmaTPC{" cfgNsigmaTPC" , {nuclei::nSigmaTPCdefault[0 ], 5 , 2 , nuclei::names, nuclei::nSigmaConfigName}, " TPC nsigma selection for light nuclei" };
196205 Configurable<LabeledArray<double >> cfgDCAcut{" cfgDCAcut" , {nuclei::DCAcutDefault[0 ], 5 , 2 , nuclei::names, nuclei::nDCAConfigName}, " Max DCAxy and DCAz for light nuclei" };
206+ Configurable<LabeledArray<double >> cfgDownscaling{" cfgDownscaling" , {nuclei::DownscalingDefault[0 ], 5 , 1 , nuclei::names, nuclei::DownscalingConfigName}, " Fraction of kept candidates for light nuclei" };
197207 Configurable<LabeledArray<int >> cfgTreeConfig{" cfgTreeConfig" , {nuclei::TreeConfigDefault[0 ], 5 , 2 , nuclei::names, nuclei::treeConfigNames}, " Filtered trees configuration" };
198208
199209 ConfigurableAxis cfgDCAxyBinsProtons{" cfgDCAxyBinsProtons" , {1500 , -1 .5f , 1 .5f }, " DCAxy binning for Protons" };
@@ -370,6 +380,7 @@ struct nucleiSpectra {
370380 {
371381 auto bc = collision.template bc_as <aod::BCsWithTimestamps>();
372382 initCCDB (bc);
383+ gRandom ->SetSeed (bc.timestamp ());
373384
374385 spectra.fill (HIST (" hRecVtxZData" ), collision.posZ ());
375386
@@ -481,6 +492,9 @@ struct nucleiSpectra {
481492 if (cfgTreeConfig->get (iS, 1u ) && !selectedTOF) {
482493 continue ;
483494 }
495+ if (cfgDownscaling->get (iS) < 1 . && gRandom ->Rndm () > cfgDownscaling->get (iS)) {
496+ continue ;
497+ }
484498 flag |= BIT (iS);
485499 }
486500 }
0 commit comments