Skip to content

Commit 9ddea56

Browse files
committed
provide downsampling
1 parent 444db75 commit 9ddea56

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

‎DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx‎

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <Framework/runDataProcessing.h>
4242
#include <ReconstructionDataFormats/PID.h>
4343

44+
#include <TRandom3.h>
4445
#include <TString.h>
4546

4647
#include <boost/preprocessor/cat.hpp>
@@ -89,7 +90,7 @@ struct TreeCreatorPidTpcDiagnostics {
8990
Configurable<bool> treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"};
9091
Configurable<bool> requireGoodRct{"requireGoodRct", false, "require good detector flag in run condtion table"};
9192

92-
struct ParticleWiseCuts : ConfigurableGroup {
93+
struct ParticleWiseCfgs : ConfigurableGroup {
9394

9495
#define DECLARE_PARTICLE_WISE_CONFIGURABLES(Unused1, ParticleNameLong, Unused2) \
9596
Configurable<float> cutTpcInnerParameterMin##ParticleNameLong{"cutTpcInnerParameterMin" #ParticleNameLong, 0.f, "Lower-value cut on tpcInnerParam for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \
@@ -99,27 +100,28 @@ struct TreeCreatorPidTpcDiagnostics {
99100
Configurable<float> cutDeDxExpectedMax##ParticleNameLong{"cutDeDxExpectedMax" #ParticleNameLong, 1e9f, "Upper-value cut on expected dE/dx for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \
100101
Configurable<float> cutDeDxDiffMin##ParticleNameLong{"cutDeDxDiffMin" #ParticleNameLong, -1e9f, "Lower-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \
101102
Configurable<float> cutDeDxDiffMax##ParticleNameLong{"cutDeDxDiffMax" #ParticleNameLong, 1e9f, "Upper-value cut on real - expected dE/dx difference for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \
102-
Configurable<float> cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, 999.f, "Cut on absolute value of nSigmaTpc for " #ParticleNameLong}; // o2-linter: disable=name/configurable (Configurable defined in macro)
103+
Configurable<float> cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, 999.f, "Cut on absolute value of nSigmaTpc for " #ParticleNameLong}; /* o2-linter: disable=name/configurable (Configurable defined in macro)*/ \
104+
Configurable<float> downsampleFactor##ParticleNameLong{"downsampleFactor" #ParticleNameLong, 1.f, "Downsampling factor for " #ParticleNameLong}; // o2-linter: disable=name/configurable (Configurable defined in macro)
103105

104106
DO_FOR_ALL_PARTICLES(DECLARE_PARTICLE_WISE_CONFIGURABLES, _)
105107
#undef DECLARE_PARTICLE_WISE_CONFIGURABLES
106-
} particleWiseCuts;
108+
} particleWiseCfgs;
107109

108-
#define PARTICLE_WISE_CUT_NAMES \
109-
(cutTpcInnerParameterMin)(cutTpcInnerParameterMax)(cutExpSigmaMax)(cutDeDxExpectedMin)(cutDeDxExpectedMax)(cutDeDxDiffMin)(cutDeDxDiffMax)(cutNSigmaTpcAbs)
110+
#define PARTICLE_WISE_CFG_NAMES \
111+
(cutTpcInnerParameterMin)(cutTpcInnerParameterMax)(cutExpSigmaMax)(cutDeDxExpectedMin)(cutDeDxExpectedMax)(cutDeDxDiffMin)(cutDeDxDiffMax)(cutNSigmaTpcAbs)(downsampleFactor)
110112

111-
#define MAKE_PARTICLE_CUT_POINTER(Unused, LongName, CutName) \
112-
&particleWiseCuts.BOOST_PP_CAT(CutName, LongName),
113+
#define MAKE_PARTICLE_CUT_POINTER(Unused, ParticleNameLong, CfgName) \
114+
&particleWiseCfgs.BOOST_PP_CAT(CfgName, ParticleNameLong),
113115

114-
#define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CutName) \
115-
const std::array<Configurable<float>*, PID::Alpha + 1> CutName{ \
116-
DO_FOR_ALL_PARTICLES(MAKE_PARTICLE_CUT_POINTER, CutName)};
116+
#define PACK_CONFIGURABLES_TO_ARRAY(Unused1, Unused2, CfgName) \
117+
const std::array<Configurable<float>*, PID::Alpha + 1> CfgName{ \
118+
DO_FOR_ALL_PARTICLES(MAKE_PARTICLE_CUT_POINTER, CfgName)};
117119

118-
BOOST_PP_SEQ_FOR_EACH(PACK_CONFIGURABLES_TO_ARRAY, _, PARTICLE_WISE_CUT_NAMES)
120+
BOOST_PP_SEQ_FOR_EACH(PACK_CONFIGURABLES_TO_ARRAY, _, PARTICLE_WISE_CFG_NAMES)
119121

120122
#undef PACK_CONFIGURABLES_TO_ARRAY
121123
#undef MAKE_PARTICLE_CUT_POINTER
122-
#undef PARTICLE_WISE_CUT_NAMES
124+
#undef PARTICLE_WISE_CFG_NAMES
123125

124126
HistogramRegistry registry{"registry", {}};
125127

@@ -129,6 +131,8 @@ struct TreeCreatorPidTpcDiagnostics {
129131

130132
o2::aod::rctsel::RCTFlagsChecker rctChecker;
131133

134+
TRandom3 mRnd{};
135+
132136
using CollisionsExtra = soa::Join<aod::Collisions, aod::Mults, aod::EvSels>;
133137
using TrackCandidates = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection>;
134138

@@ -224,6 +228,10 @@ struct TreeCreatorPidTpcDiagnostics {
224228
const auto tracksFromCollision = tracks.sliceBy(perCollisionTracks, static_cast<int>(collision.globalIndex()));
225229

226230
for (const auto& track : tracksFromCollision) {
231+
if (*downsampleFactor.at(ParticleId) < 1.f && mRnd.Uniform(1) > *downsampleFactor.at(ParticleId)) {
232+
continue;
233+
}
234+
227235
bool isGoodTrack = isTrackSelected(track, trackSelection);
228236
isGoodTrack &= (!requireGlobalTrack || track.isGlobalTrack());
229237
isGoodTrack &= (!requireIts || track.hasITS());

0 commit comments

Comments
 (0)