Skip to content

Commit 4b2ebd7

Browse files
pgruselljose-luis-rs
authored andcommitted
feat(r3bgen): Add method to select only p2p and ppn reactions in the INCL generator.
fix(r3bgen): Allow for non-QF p2p selection. fix(r3bgen): Add copilot suggestions.
1 parent 9e0a9fc commit 4b2ebd7

2 files changed

Lines changed: 77 additions & 6 deletions

File tree

r3bgen/R3BINCLRootGenerator.cxx

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ bool R3BINCLRootGenerator::ReadEvent(FairPrimaryGenerator* primGen)
8686
if (!validevent)
8787
{
8888
fEvt++;
89+
continue;
8990
}
9091
}
9192
else if (fOnlySpallation)
@@ -96,8 +97,34 @@ bool R3BINCLRootGenerator::ReadEvent(FairPrimaryGenerator* primGen)
9697
if (!validevent)
9798
{
9899
fEvt++;
100+
continue;
99101
}
100102
}
103+
104+
else if (fOnlyP2pSpallation)
105+
{
106+
Int_t nbp = 0;
107+
for (Int_t j = 0; j < fParticles; j++)
108+
if (fOrigin[j] == 0)
109+
validevent = true;
110+
if (!validevent)
111+
{
112+
fEvt++;
113+
continue;
114+
}
115+
116+
for (Int_t j = 0; j < fParticles; j++)
117+
if (fPdgCode[j] == 2212)
118+
nbp++;
119+
120+
if (nbp != 2 && validevent)
121+
{
122+
fEvt++;
123+
validevent = false;
124+
continue;
125+
}
126+
}
127+
101128
else if (fOnlyP2pFission)
102129
{
103130
Int_t nbp = 0;
@@ -107,6 +134,7 @@ bool R3BINCLRootGenerator::ReadEvent(FairPrimaryGenerator* primGen)
107134
if (!validevent)
108135
{
109136
fEvt++;
137+
continue;
110138
}
111139

112140
for (Int_t j = 0; j < fParticles; j++)
@@ -117,14 +145,45 @@ bool R3BINCLRootGenerator::ReadEvent(FairPrimaryGenerator* primGen)
117145
{
118146
fEvt++;
119147
validevent = false;
148+
continue;
120149
}
121150
}
151+
152+
else if (fOnlyPpnSpallation)
153+
{
154+
Int_t nbp = 0;
155+
Int_t nbn = 0;
156+
for (Int_t j = 0; j < fParticles; j++)
157+
if (fOrigin[j] == 0)
158+
validevent = true;
159+
if (!validevent)
160+
{
161+
fEvt++;
162+
continue;
163+
}
164+
165+
for (Int_t j = 0; j < fParticles; j++)
166+
{
167+
if (fPdgCode[j] == 2212)
168+
nbp++;
169+
if (fPdgCode[j] == 2112)
170+
nbn++;
171+
}
172+
173+
if ((nbp != 1 || nbn != 1) && validevent)
174+
{
175+
fEvt++;
176+
validevent = false;
177+
continue;
178+
}
179+
}
180+
122181
else
123182
{
124183
validevent = true;
125184
}
126185

127-
if (fEvt > fEvtRoot)
186+
if (fEvt >= fEvtRoot)
128187
{
129188
LOG(error)
130189
<< "\033[5m\033[31m R3BINCLRootGenerator: Number of simulated events larger than the ones contained "

r3bgen/R3BINCLRootGenerator.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ class R3BINCLRootGenerator : public FairGenerator
7575
**/
7676
void SetOnlyP2pFission(bool Opt = true) { fOnlyP2pFission = Opt; }
7777

78+
/**
79+
** Method to simulate only p2p-spallation events
80+
**/
81+
void SetOnlyP2pSpallation(bool Opt = true) { fOnlyP2pSpallation = Opt; }
82+
83+
/**
84+
** Method to simulate only ppn-spallation events
85+
**/
86+
void SetOnlyPpnSpallation(bool Opt = true) { fOnlyPpnSpallation = Opt; }
87+
7888
/**
7989
** Method to simulate only fragments (changed with SetMinPdgCode)
8090
**/
@@ -90,11 +100,13 @@ class R3BINCLRootGenerator : public FairGenerator
90100
private:
91101
TString fFileName; // Input file name
92102
TFile* fInput;
93-
bool fOnlyFission = false; // True if we want to simulate only fission events
94-
bool fOnlyP2pFission = false; // True if we want to simulate only p2p-fission events
95-
bool fOnlySpallation = false; // True if we want to simulate only spallation events
96-
bool fOnlyFragments = false; // True if we want to simulate only fragments
97-
int fPdgCodeMin = 1000050070; // Limit in Boro-7
103+
bool fOnlyFission = false; // True if we want to simulate only fission events
104+
bool fOnlyP2pFission = false; // True if we want to simulate only p2p-fission events
105+
bool fOnlyP2pSpallation = false; // True if we want to simulate only p2p-spallation events
106+
bool fOnlyPpnSpallation = false; // True if we want to simulate only ppn-spallation events
107+
bool fOnlySpallation = false; // True if we want to simulate only spallation events
108+
bool fOnlyFragments = false; // True if we want to simulate only fragments
109+
int fPdgCodeMin = 1000050070; // Limit in Boro-7
98110
double fRotXBeam = 0.;
99111
double fRotYBeam = 0.;
100112

0 commit comments

Comments
 (0)