Skip to content

Commit 0d93a48

Browse files
lucamichelettisawenzel
authored andcommitted
Adding script for Nuclei at Fwd & rapidity range in the .gun file
1 parent fcc4d13 commit 0d93a48

5 files changed

Lines changed: 65 additions & 16 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[GeneratorExternal]
2+
fileName=${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_longlived_gaptriggered.C
3+
funcName=generateLongLivedGapTriggered("${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei_fwd.gun", 5)
4+
5+
[GeneratorPythia8]
6+
config=${O2_ROOT}/share/Generators/egconfig/pythia8_inel.cfg
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# PDG N ptMin ptMax
2-
1000010020 1 0.2 6
3-
1000010030 1 0.2 6
4-
1000020030 1 0.2 6
5-
1000020040 1 0.2 6
6-
1010010030 1 0.2 6
1+
# PDG N ptMin ptMax yMin yMax
2+
1000010020 1 0.2 6 -1 1
3+
1000010030 1 0.2 6 -1 1
4+
1000020030 1 0.2 6 -1 1
5+
1000020040 1 0.2 6 -1 1
6+
1010010030 1 0.2 6 -1 1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# PDG N ptMin ptMax yMin yMax
2+
1000020030 10 0. 10. -4. -2.5

MC/config/PWGLF/pythia8/generator_pythia8_longlived_gaptriggered.C

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ class GeneratorPythia8LongLivedGapTriggered : public o2::eventgen::GeneratorPyth
2121
{
2222
public:
2323
/// Constructor
24-
GeneratorPythia8LongLivedGapTriggered(std::vector<int> input_pdg, int input_trigger_ratio = 1, int n_injected = 1, float pt_min = 1, float pt_max = 10)
24+
GeneratorPythia8LongLivedGapTriggered(std::vector<int> input_pdg, int input_trigger_ratio = 1, int n_injected = 1, float pt_min = 1, float pt_max = 10, float y_min = -1, float y_max = 1)
2525
{
2626
mPdg = input_pdg;
2727
setNinjected(n_injected);
2828
mInverseTriggerRatio = input_trigger_ratio;
2929
setPt(pt_min, pt_max);
30+
setY(y_min, y_max);
3031
mMass = getMass(input_pdg);
3132
mGeneratedEvents = 0;
3233
mAlternatingPDGsign = true;
@@ -42,18 +43,22 @@ public:
4243
int pdg = 0;
4344
unsigned long n_inj = 0;
4445
float pt_min = 0.;
45-
float pt_max = 0;
46+
float pt_max = 0.;
47+
float y_min = 0.;
48+
float y_max = 0.;
4649
if (!config_file.is_open())
4750
{
4851
LOGF(fatal, "File %s cannot be opened.", expanded_file_name);
4952
}
5053
std::getline(config_file, header); // skip first line
51-
while (config_file >> pdg >> n_inj >> pt_min >> pt_max)
54+
while (config_file >> pdg >> n_inj >> pt_min >> pt_max >> y_min >> y_max)
5255
{
5356
mPdg.push_back(pdg);
5457
mNinjected.push_back(n_inj);
5558
mPtMin.push_back(pt_min);
5659
mPtMax.push_back(pt_max);
60+
mYmin.push_back(y_min);
61+
mYmax.push_back(y_max);
5762
}
5863
config_file.close();
5964
mInverseTriggerRatio = input_trigger_ratio;
@@ -81,8 +86,11 @@ public:
8186
/// Set rapidity
8287
void setY(float y_min, float y_max)
8388
{
84-
mYmin = y_min;
85-
mYmax = y_max;
89+
for (auto part : mPdg)
90+
{
91+
mYmin.push_back(y_min);
92+
mYmax.push_back(y_max);
93+
}
8694
}
8795

8896
/// Set pseudorapidity
@@ -130,7 +138,7 @@ public:
130138
for (int i = 0; i < mNinjected[injectionIndex]; ++i)
131139
{
132140
const double pt = gRandom->Uniform(mPtMin[injectionIndex], mPtMax[injectionIndex]);
133-
const double rapidity = gRandom->Uniform(mYmin, mYmax);
141+
const double rapidity = gRandom->Uniform(mYmin[injectionIndex], mYmax[injectionIndex]);
134142
const double phi = gRandom->Uniform(0, TMath::TwoPi());
135143
const double px{pt * std::cos(phi)};
136144
const double py{pt * std::sin(phi)};
@@ -157,8 +165,8 @@ private:
157165

158166
std::vector<double> mPtMin; /// minimum transverse momentum for generated particles
159167
std::vector<double> mPtMax; /// maximum transverse momentum for generated particles
160-
double mYmin = -1.; /// minimum rapidity for generated particles
161-
double mYmax = +1.; /// maximum rapidity for generated particles
168+
std::vector<double> mYmin; /// minimum rapidity for generated particles
169+
std::vector<double> mYmax; /// maximum rapidity for generated particles
162170

163171
bool mAlternatingPDGsign = true; /// bool to randomize the PDG code of the core particle
164172

@@ -170,9 +178,9 @@ private:
170178
};
171179

172180
///___________________________________________________________
173-
FairGenerator *generateLongLivedGapTriggered(std::vector<int> mPdg, int input_trigger_ratio, int n_injected = 1, float pt_min = 1, float pt_max = 10, bool alternate_sign = true)
181+
FairGenerator *generateLongLivedGapTriggered(std::vector<int> mPdg, int input_trigger_ratio, int n_injected = 1, float pt_min = 1, float pt_max = 10, float y_min = -1, float y_max = 1, bool alternate_sign = true)
174182
{
175-
auto myGen = new GeneratorPythia8LongLivedGapTriggered(mPdg, input_trigger_ratio, n_injected, pt_min, pt_max);
183+
auto myGen = new GeneratorPythia8LongLivedGapTriggered(mPdg, input_trigger_ratio, n_injected, pt_min, pt_max, y_min, y_max);
176184
myGen->setAlternatingPDGsign(alternate_sign);
177185
auto seed = (gRandom->TRandom::GetSeed() % 900000000);
178186
myGen->readString("Random:setSeed on");
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
#
4+
# A example workflow MC->RECO->AOD for a simple pp min bias
5+
# production, targetting test beam conditions.
6+
7+
# make sure O2DPG + O2 is loaded
8+
[ ! "${O2DPG_ROOT}" ] && echo "Error: This needs O2DPG loaded" && exit 1
9+
[ ! "${O2_ROOT}" ] && echo "Error: This needs O2 loaded" && exit 1
10+
11+
# ----------- LOAD UTILITY FUNCTIONS --------------------------
12+
. ${O2_ROOT}/share/scripts/jobutils.sh
13+
14+
# ----------- START ACTUAL JOB -----------------------------
15+
16+
NWORKERS=${NWORKERS:-8}
17+
MODULES="--skipModules ZDC"
18+
SIMENGINE=${SIMENGINE:-TGeant3}
19+
NSIGEVENTS=${NSIGEVENTS:-1}
20+
NBKGEVENTS=${NBKGEVENTS:-1}
21+
NTIMEFRAMES=${NTIMEFRAMES:-1}
22+
INTRATE=${INTRATE:-500000}
23+
SYSTEM=${SYSTEM:-pp}
24+
ENERGY=${ENERGY:-13600}
25+
[[ ${SPLITID} != "" ]] && SEED="-seed ${SPLITID}" || SEED=""
26+
27+
# create workflow
28+
${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py -eCM ${ENERGY} -col ${SYSTEM} -gen external -j ${NWORKERS} -ns ${NSIGEVENTS} -tf ${NTIMEFRAMES} -interactionRate ${INTRATE} -confKey "Diamond.width[0]=0.1;Diamond.width[1]=0.1;Diamond.width[2]=6." -e ${SIMENGINE} ${SEED} -mod "--skipModules ZDC" \
29+
-ini ${O2DPG_ROOT}/MC/config/PWGLF/ini/GeneratorLFNucleiFwd${SYSTEM}Gap.ini
30+
31+
# run workflow
32+
# allow increased timeframe parallelism with --cpu-limit 32
33+
${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py -f workflow.json -tt aod --cpu-limit 32

0 commit comments

Comments
 (0)