Skip to content

Commit 75b74ea

Browse files
committed
[PWGLF] added event rejection
1 parent f432977 commit 75b74ea

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

PWGLF/Tasks/Nuspex/antinucleiInJets.cxx

Lines changed: 20 additions & 1 deletion
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"};
@@ -367,7 +370,7 @@ struct AntinucleiInJets {
367370
return false;
368371
if (std::fabs(track.dcaZ()) > 2.0)
369372
return false;
370-
return true;
373+
return false;
371374
}
372375

373376
// single-track selection
@@ -440,9 +443,23 @@ 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()) return;
462+
446463
// event counter: before event selection
447464
registryData.fill(HIST("number_of_events_data"), 0.5);
448465

@@ -1198,6 +1215,8 @@ struct AntinucleiInJets {
11981215
// Process Systematics
11991216
void processSystematicsData(SelectedCollisions::iterator const& collision, FullNucleiTracks const& tracks)
12001217
{
1218+
if(rejectEvents && shouldRejectEvent()) return;
1219+
12011220
const int nSystematics = 10;
12021221
int itsNclustersSyst[nSystematics] = {5, 6, 5, 4, 5, 3, 5, 6, 3, 4};
12031222
float tpcNcrossedRowsSyst[nSystematics] = {100, 85, 80, 110, 95, 90, 105, 95, 100, 105};

0 commit comments

Comments
 (0)