Skip to content

Commit 5a1079b

Browse files
authored
Enable DPMJET (#1832)
1 parent b50d3de commit 5a1079b

File tree

2 files changed

+45
-21
lines changed

2 files changed

+45
-21
lines changed

MC/config/PWGUD/external/generator/GeneratorStarlight.C

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//R__LOAD_LIBRARY(libDPMJET.so)
2-
//R__LOAD_LIBRARY(libDpmJetLib.so)
1+
R__LOAD_LIBRARY(libDPMJET.so)
2+
R__LOAD_LIBRARY(libDpmJetLib.so)
33
R__LOAD_LIBRARY(libStarlib.so)
44
R__ADD_INCLUDE_PATH($STARlight_ROOT/include)
55

@@ -104,7 +104,7 @@ class GeneratorStarlight_class : public Generator
104104
{"kIncohPsi2sToElPi", 4, 444011, 20, -1.0, -1.0, 100443, 1 }, //
105105
{"kIncohUpsilonToMu", 4, 553013, 20, -1.0, -1.0, 553, 0 }, //
106106
{"kIncohUpsilonToEl", 4, 553011, 20, -1.0, -1.0, 553, 0 }, //
107-
// {"kDpmjetSingle", 5, 113, 20, -1.0, -1.0, -1, 0 }, //
107+
{"kDpmjetSingle", 5, 113, 20, -1.0, -1.0, -1, 0 }, //
108108
{"kTauLowToEl3Pi", 1, 15, 990, 3.5, 20.0, -1, 1 }, // from 0.4 to 15 GeV
109109
{"kTauLowToPo3Pi", 1, 15, 990, 3.5, 20.0, -1, 1 }, // from 0.4 to 15 GeV
110110
{"kTauLowToElMu", 1, 15, 990, 3.5, 20.0, -1, 1 }, // from 0.4 to 15 GeV
@@ -312,8 +312,28 @@ class GeneratorStarlight_class : public Generator
312312

313313

314314
FairGenerator*
315-
GeneratorStarlight(std::string configuration = "empty",float energyCM = 5020, int beam1Z = 82, int beam1A = 208, int beam2Z = 82, int beam2A = 208, std::string extrapars = "")
315+
GeneratorStarlight(std::string configuration = "empty",float energyCM = 5020, int beam1Z = 82, int beam1A = 208, int beam2Z = 82, int beam2A = 208, std::string extrapars = "",std::string dpmjetconf = "")
316316
{
317+
if(dpmjetconf.size() != 0){
318+
//Copy necesary files to the working directory
319+
TString pathDPMJET = gSystem->ExpandPathName("$DPMJET_ROOT/dpmdata");
320+
system(TString::Format("cp -r %s .",pathDPMJET.Data()));
321+
system(TString::Format("cp %s ./my.input",dpmjetconf.c_str()));
322+
323+
//Reset four seeds of the DPMJET random generator in the config
324+
std::random_device rd;
325+
std::mt19937 gen(rd());
326+
std::uniform_int_distribution<> dist(1, 168);
327+
328+
std::string command = "awk -i inplace -v nums=\"";
329+
for (int i = 0; i < 4; ++i)command += TString::Format("%d.0 ", dist(gen));
330+
command +=" \" \' ";
331+
command += "BEGIN {split(nums, newvals);}";
332+
command += "{if ($1 == \"RNDMINIT\") {printf \"%-16s%-9s%-9s%-9s%-9s\\n\", $1, newvals[1], newvals[2], newvals[3], newvals[4];}";
333+
command += " else {print $0;}}\' \"my.input\" ";
334+
system(command.c_str());
335+
}
336+
317337
auto gen = new o2::eventgen::GeneratorStarlight_class();
318338
gen->selectConfiguration(configuration);
319339
gen->setCollisionSystem(energyCM, beam1Z, beam1A, beam2Z, beam2A);

MC/config/PWGUD/ini/makeStarlightConfig.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
parser.add_argument('--extraPars', default='',
2828
help='Extra parameters for SL config')
2929

30+
parser.add_argument('--dpmjetConf', default='',
31+
help='DPMJET config file')
32+
3033

3134
args = parser.parse_args()
3235

@@ -76,25 +79,26 @@
7679
fout.write('funcName = GeneratorStarlightToEvtGen("%s", %f, %d, %d, %d, %d, "%s") \n' % (args.process,args.eCM ,pZ,pA,tZ,tA,args.extraPars))
7780
else:
7881
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/external/generator/GeneratorStarlight.C \n')
79-
fout.write('funcName = GeneratorStarlight("%s", %f, %d, %d, %d, %d, "%s") \n' % (args.process,args.eCM ,pZ,pA,tZ,tA,args.extraPars))
82+
fout.write('funcName = GeneratorStarlight("%s", %f, %d, %d, %d, %d, "%s", "%s") \n' % (args.process,args.eCM ,pZ,pA,tZ,tA,args.extraPars,args.dpmjetConf))
8083

8184
###Trigger
82-
fout.write('[TriggerExternal] \n')
83-
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/trigger/selectParticlesInAcceptance.C \n')
84-
if 'kTwoGamma' in args.process or 'kTau' in args.process:
85-
if args.rapidity == 'cent_eta':
86-
fout.write('funcName = selectDirectPartInAcc(-0.9,0.9) \n')
87-
if args.rapidity == 'muon_eta':
88-
fout.write('funcName = selectDirectPartInAcc(-4.0,-2.5) \n')
89-
else:
90-
if args.rapidity == 'cent_rap':
91-
fout.write('funcName = selectMotherPartInAcc(-0.9,0.9) \n')
92-
if args.rapidity == 'muon_rap':
93-
fout.write('funcName = selectMotherPartInAcc(-4.0,-2.5) \n')
94-
if args.rapidity == 'cent_eta':
95-
fout.write('funcName = selectDaughterPartInAcc(-0.9,0.9) \n')
96-
if args.rapidity == 'muon_eta':
97-
fout.write('funcName = selectDaughterPartInAcc(-4.0,-2.5) \n')
85+
if not 'kDpmjet' in args.process:
86+
fout.write('[TriggerExternal] \n')
87+
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/trigger/selectParticlesInAcceptance.C \n')
88+
if 'kTwoGamma' in args.process or 'kTau' in args.process:
89+
if args.rapidity == 'cent_eta':
90+
fout.write('funcName = selectDirectPartInAcc(-0.9,0.9) \n')
91+
if args.rapidity == 'muon_eta':
92+
fout.write('funcName = selectDirectPartInAcc(-4.0,-2.5) \n')
93+
else:
94+
if args.rapidity == 'cent_rap':
95+
fout.write('funcName = selectMotherPartInAcc(-0.9,0.9) \n')
96+
if args.rapidity == 'muon_rap':
97+
fout.write('funcName = selectMotherPartInAcc(-4.0,-2.5) \n')
98+
if args.rapidity == 'cent_eta':
99+
fout.write('funcName = selectDaughterPartInAcc(-0.9,0.9) \n')
100+
if args.rapidity == 'muon_eta':
101+
fout.write('funcName = selectDaughterPartInAcc(-4.0,-2.5) \n')
98102

99103
### close outout file
100104
fout.close()

0 commit comments

Comments
 (0)