Skip to content

Commit abd62f2

Browse files
[PWGLF] added event rejection (#10595)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent fb689f2 commit abd62f2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

PWGLF/Tasks/Nuspex/antinucleiInJets.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <TVector2.h>
2525
#include <TVector3.h>
2626
#include "TGrid.h"
27+
#include <random>
2728

2829
#include "CCDB/BasicCCDBManager.h"
2930
#include "CCDB/CcdbApi.h"
@@ -93,6 +94,8 @@ struct AntinucleiInJets {
9394
// track parameters
9495
Configurable<bool> requirePvContributor{"requirePvContributor", false, "require that the track is a PV contributor"};
9596
Configurable<bool> applyItsPid{"applyItsPid", true, "apply ITS PID"};
97+
Configurable<bool> rejectEvents{"rejectEvents", false, "reject some events"};
98+
Configurable<int> rejectionPercentage{"rejectionPercentage", 3, "percentage of events to reject"};
9699
Configurable<int> minItsNclusters{"minItsNclusters", 5, "minimum number of ITS clusters"};
97100
Configurable<int> minTpcNcrossedRows{"minTpcNcrossedRows", 80, "minimum number of TPC crossed pad rows"};
98101
Configurable<double> minTpcNcrossedRowsOverFindable{"minTpcNcrossedRowsOverFindable", 0.8, "crossed rows/findable"};
@@ -440,9 +443,24 @@ struct AntinucleiInJets {
440443
LOGP(info, "Opened histogram {}", Form("%s_antiproton", histname_antip_ue.Data()));
441444
}
442445

446+
bool shouldRejectEvent()
447+
{
448+
static std::random_device rd;
449+
static std::mt19937 gen(rd());
450+
static std::uniform_int_distribution<> dis(0, 99);
451+
int randomNumber = dis(gen);
452+
if (randomNumber <= rejectionPercentage) {
453+
return false;
454+
}
455+
return true;
456+
}
457+
443458
// Process Data
444459
void processData(SelectedCollisions::iterator const& collision, FullNucleiTracks const& tracks)
445460
{
461+
if (rejectEvents && shouldRejectEvent())
462+
return;
463+
446464
// event counter: before event selection
447465
registryData.fill(HIST("number_of_events_data"), 0.5);
448466

@@ -1198,6 +1216,9 @@ struct AntinucleiInJets {
11981216
// Process Systematics
11991217
void processSystematicsData(SelectedCollisions::iterator const& collision, FullNucleiTracks const& tracks)
12001218
{
1219+
if (rejectEvents && shouldRejectEvent())
1220+
return;
1221+
12011222
const int nSystematics = 10;
12021223
int itsNclustersSyst[nSystematics] = {5, 6, 5, 4, 5, 3, 5, 6, 3, 4};
12031224
float tpcNcrossedRowsSyst[nSystematics] = {100, 85, 80, 110, 95, 90, 105, 95, 100, 105};

0 commit comments

Comments
 (0)