Skip to content

Commit 618ce65

Browse files
committed
[PWGLF] added spin-isospin scaling factor and removed event selection
1 parent b001ad0 commit 618ce65

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

MC/config/PWGLF/ini/tests/GeneratorLF_deuteron_wigner.C

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ int External() {
3131
}
3232

3333
if (nSelected == 0) {
34-
std::cerr << "No event of interest\n";
35-
return 1;
34+
std::cout << "No events with deuterons found.\n";
35+
} else {
36+
std::cout << "Found " << nSelected << " events with deuterons\n";
3637
}
37-
38-
std::cout << "Found " << nSelected << " events with deuterons\n";
3938
return 0;
39+
4040
}
4141

MC/config/PWGLF/pythia8/generator_pythia8_deuteron_wigner.C

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,35 +46,26 @@ public:
4646
~GeneratorPythia8DeuteronWigner() override = default;
4747

4848
bool Init() override {
49-
addSubGenerator(0, "Pythia8 with (anti)deuterons formed via coalescence using the Wigner density formalism");
49+
addSubGenerator(0, "Pythia8 events with (anti)deuterons formed via coalescence using the Wigner density formalism, provided the coalescence condition is fulfilled");
5050
return o2::eventgen::GeneratorPythia8::Init();
5151
}
5252

5353
protected:
5454
bool generateEvent() override {
55-
if (mGeneratedEvents % 100 == 0) {
56-
LOG(info) << ">> Generating event " << mGeneratedEvents;
57-
}
58-
59-
bool genOk = false;
60-
int localCounter = 0;
61-
while (!genOk) {
62-
if (GeneratorPythia8::generateEvent()) {
63-
genOk = selectEvent(mPythia.event);
64-
}
65-
localCounter++;
55+
56+
if (GeneratorPythia8::generateEvent() && EventHasDeuteron(mPythia.event)) {
57+
LOG(debug) << ">> A Deuteron was formed!";
6658
}
6759

68-
LOG(debug) << ">> Generation of event of interest successful after " << localCounter << " iterations";
6960
notifySubGenerator(0);
7061
++mGeneratedEvents;
7162
return true;
7263
}
7364

74-
bool selectEvent(Pythia8::Event& event) {
65+
bool EventHasDeuteron(Pythia8::Event& event) {
7566

76-
const double md = 1.87561294257; // Deuteron mass [GeV]
7767
bool deuteronIsFormed = false;
68+
const double md = 1.87561294257; // Deuteron mass [GeV]
7869

7970
std::vector<int> proton_ID, neutron_ID;
8071
std::vector<int> proton_status, neutron_status;
@@ -94,10 +85,6 @@ protected:
9485
}
9586
}
9687

97-
if (proton_ID.empty() || neutron_ID.empty()) {
98-
return false;
99-
}
100-
10188
int radiusBin = mTwoDimCoalProbability->GetXaxis()->FindBin(mSourceRadius);
10289
TH1D* prob_vs_q = mTwoDimCoalProbability->ProjectionY("prob_vs_q", radiusBin, radiusBin, "E");
10390
prob_vs_q->SetDirectory(nullptr);
@@ -130,9 +117,10 @@ protected:
130117
continue;
131118
}
132119
double coalProb = prob_vs_q->GetBinContent(prob_vs_q->FindBin(deltaP));
133-
double rnd = gRandom->Uniform(0.0, 1.0);
120+
double rndCoalProb = gRandom->Uniform(0.0, 1.0);
121+
double rndSpinIsospin = gRandom->Uniform(0.0, 1.0);
134122

135-
if (rnd < coalProb) {
123+
if (rndCoalProb < coalProb && rndSpinIsospin < 3.0/8.0) {
136124
double energy = std::hypot(p.pAbs(), md);
137125
p.e(energy);
138126
int deuteronPDG = sign_p * 1000010020;

0 commit comments

Comments
 (0)