Skip to content

Commit 9ef97b7

Browse files
committed
Tuning of the dpmjet decays and inclusion of neutron generator
1 parent f503c23 commit 9ef97b7

File tree

7 files changed

+193
-45
lines changed

7 files changed

+193
-45
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Decay D*+
2+
1.0 D0 pi+ VSS;
3+
Enddecay
4+
5+
Decay D*-
6+
1.0 anti-D0 pi- VSS;
7+
Enddecay
8+
9+
Decay D+
10+
1.0 K- pi+ pi+ D_DALITZ; #[Reconstructed PDG2011]
11+
Enddecay
12+
13+
Decay D-
14+
1.0 K+ pi- pi- D_DALITZ; #[Reconstructed PDG2011]
15+
Enddecay
16+
17+
Decay D0
18+
1.0 K- pi+ PHSP; #[Reconstructed PDG2011]
19+
Enddecay
20+
21+
Decay anti-D0
22+
1.0 K+ pi- PHSP; #[Reconstructed PDG2011]
23+
Enddecay
24+
25+
Decay Lambda_c+
26+
1.0 p+ K- pi+ PHSP; #[New mode added] #[Reconstructed PDG2011]
27+
Enddecay
28+
29+
Decay anti-Lambda_c-
30+
1.0 anti-p- K+ pi- PHSP; #[New mode added] #[Reconstructed PDG2011]
31+
Enddecay
32+
33+
Decay D_s+
34+
1.0 phi pi+ SVS; #[Reconstructed PDG2011]
35+
Enddecay
36+
37+
Decay D_s-
38+
1.0 phi pi- SVS; #[Reconstructed PDG2011]
39+
Enddecay
40+
41+
Decay phi
42+
1.0 K+ K- VSS; #[Reconstructed PDG2011]
43+
Enddecay
44+
45+
End

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

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,27 @@ class GeneratorStarlight_class : public Generator
3737
public:
3838
GeneratorStarlight_class(){};
3939
~GeneratorStarlight_class() = default;
40+
41+
void setupDpmjet(std::string dpmjetconf){
42+
if(dpmjetconf.size() == 0)return;
43+
//Copy necesary files to the working directory
44+
TString pathDPMJET = gSystem->ExpandPathName("$DPMJET_ROOT/dpmdata");
45+
system(TString::Format("cp -r %s .",pathDPMJET.Data()));
46+
system(TString::Format("cp %s ./my.input",dpmjetconf.c_str()));
47+
48+
//Reset four seeds of the DPMJET random generator in the config
49+
std::mt19937 gen(generateRandomSeed());
50+
std::uniform_int_distribution<> dist(1, 168);
51+
52+
std::string command = "awk -i inplace -v nums=\"";
53+
for (int i = 0; i < 4; ++i)command += TString::Format("%d.0 ", dist(gen));
54+
command +=" \" \' ";
55+
command += "BEGIN {split(nums, newvals);}";
56+
command += "{if ($1 == \"RNDMINIT\") {printf \"%-16s%-9s%-9s%-9s%-9s\\n\", $1, newvals[1], newvals[2], newvals[3], newvals[4];}";
57+
command += " else {print $0;}}\' \"my.input\" ";
58+
system(command.c_str());
59+
}
60+
4061
void selectConfiguration(std::string val) { mSelectedConfiguration = val; };
4162
void setExtraParams(std::string val) { mExtraParams = val; };
4263
void setCollisionSystem(float energyCM, int beam1Z, int beam1A, int beam2Z, int beam2A) {eCM = energyCM; projZ=beam1Z; projA=beam1A; targZ=beam2Z; targA=beam2A;};
@@ -48,6 +69,10 @@ class GeneratorStarlight_class : public Generator
4869
return true;
4970
}
5071
int getPdgMother(){return mPdgMother;}
72+
double getPhotonEnergy(){
73+
//std::cout << mEvent.getGamma().gamma.GetE() << std::endl;
74+
return mEvent.getGamma().gamma.GetE();
75+
}
5176

5277
bool Init() override
5378
{
@@ -305,7 +330,14 @@ class GeneratorStarlight_class : public Generator
305330
}
306331
return true;
307332
}
308-
333+
334+
protected:
335+
float eCM = 5020; //CMS energy
336+
int projA=208; //Beam
337+
int targA=208;
338+
int projZ=82;
339+
int targZ=82;
340+
309341
private:
310342
starlight *mStarLight = 0x0;
311343
inputParameters mInputParameters; // simulation input information.
@@ -316,11 +348,7 @@ class GeneratorStarlight_class : public Generator
316348
std::string mExtraParams = "";
317349
int mPdgMother = -1;
318350
bool mDecayEvtGen = 0;
319-
float eCM = 5020; //CMS energy
320-
int projA=208; //Beam
321-
int targA=208;
322-
int projZ=82;
323-
int targZ=82;
351+
324352

325353
};
326354

@@ -331,29 +359,12 @@ class GeneratorStarlight_class : public Generator
331359
FairGenerator*
332360
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 = "")
333361
{
334-
if(dpmjetconf.size() != 0){
335-
//Copy necesary files to the working directory
336-
TString pathDPMJET = gSystem->ExpandPathName("$DPMJET_ROOT/dpmdata");
337-
system(TString::Format("cp -r %s .",pathDPMJET.Data()));
338-
system(TString::Format("cp %s ./my.input",dpmjetconf.c_str()));
339-
340-
//Reset four seeds of the DPMJET random generator in the config
341-
std::mt19937 gen(generateRandomSeed());
342-
std::uniform_int_distribution<> dist(1, 168);
343-
344-
std::string command = "awk -i inplace -v nums=\"";
345-
for (int i = 0; i < 4; ++i)command += TString::Format("%d.0 ", dist(gen));
346-
command +=" \" \' ";
347-
command += "BEGIN {split(nums, newvals);}";
348-
command += "{if ($1 == \"RNDMINIT\") {printf \"%-16s%-9s%-9s%-9s%-9s\\n\", $1, newvals[1], newvals[2], newvals[3], newvals[4];}";
349-
command += " else {print $0;}}\' \"my.input\" ";
350-
system(command.c_str());
351-
}
352362

353363
auto gen = new o2::eventgen::GeneratorStarlight_class();
354364
gen->selectConfiguration(configuration);
355365
gen->setCollisionSystem(energyCM, beam1Z, beam1A, beam2Z, beam2A);
356366
gen->setExtraParams(extrapars);
367+
gen->setupDpmjet(dpmjetconf);
357368
return gen;
358369
}
359370

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,43 @@
1-
// usage (fwdy) :
2-
// o2-sim -j 4 -n 10 -g external -t external -m "PIPE ITS TPC" -o sgn --configFile GeneratorHF_bbbar_fwdy.ini
3-
// usage (midy) :
4-
// o2-sim -j 4 -n 10 -g external -t external -m "PIPE ITS TPC" -o sgn --configFile GeneratorHF_bbbar_midy.ini
5-
//
6-
//
71
R__ADD_INCLUDE_PATH($O2DPG_MC_CONFIG_ROOT/MC/config/PWGDQ/EvtGen)
82
R__ADD_INCLUDE_PATH($O2DPG_MC_CONFIG_ROOT/MC/config/PWGUD/external/generator)
93
#include "GeneratorEvtGen.C"
104
#include "GeneratorStarlight.C"
115

126
FairGenerator*
13-
GeneratorStarlightToEvtGen(std::string configuration = "empty",float energyCM = 5020, int beam1Z = 82, int beam1A = 208, int beam2Z = 82, int beam2A = 208, std::string extrapars = "")
7+
GeneratorStarlightToEvtGen(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 = "")
148
{
159
auto gen = new o2::eventgen::GeneratorEvtGen<o2::eventgen::GeneratorStarlight_class>();
1610
gen->selectConfiguration(configuration);
1711
gen->setCollisionSystem(energyCM, beam1Z, beam1A, beam2Z, beam2A);
1812
gen->setExtraParams(extrapars);
19-
20-
gen->SetSizePdg(5);
21-
gen->AddPdg(443,0);
22-
gen->AddPdg(100443,1);
23-
gen->AddPdg(223,2);
24-
gen->AddPdg(15,3);
25-
gen->AddPdg(-15,4);
26-
if (configuration.find("kTau") == std::string::npos) gen->SetPolarization(1); //Transversal
13+
gen->setupDpmjet(dpmjetconf);
14+
15+
if (configuration.find("kTau") != std::string::npos){
16+
gen->SetSizePdg(2);
17+
gen->AddPdg(15,0);
18+
gen->AddPdg(-15,1);
19+
}
20+
else if(configuration.find("kDpmjet") != std::string::npos){
21+
gen->SetSizePdg(11);
22+
gen->AddPdg( 411,0);
23+
gen->AddPdg(-411,1);
24+
gen->AddPdg( 421,2);
25+
gen->AddPdg(-421,3);
26+
gen->AddPdg( 413,4);
27+
gen->AddPdg(-413,5);
28+
gen->AddPdg( 431,6);
29+
gen->AddPdg(-431,7);
30+
gen->AddPdg( 4122,8);
31+
gen->AddPdg(-4122,9);
32+
gen->AddPdg( 333,10);
33+
}
34+
else{
35+
gen->SetPolarization(1); //Transversal
36+
gen->SetSizePdg(3);
37+
gen->AddPdg(443,0);
38+
gen->AddPdg(100443,1);
39+
gen->AddPdg(223,2);
40+
}
2741

2842
TString pathO2 = gSystem->ExpandPathName("$O2DPG_MC_CONFIG_ROOT/MC/config/PWGUD/external/generator/DecayTablesEvtGen");
2943
if (configuration.find("Psi2sToMuPi") != std::string::npos) gen->SetDecayTable(Form("%s/PSI2S.MUMUPIPI.DEC",pathO2.Data()));
@@ -38,6 +52,7 @@ FairGenerator*
3852
else if (configuration.find("ToPoPiPi0") != std::string::npos) gen->SetDecayTable(Form("%s/TAUTAU.POPI.DEC",pathO2.Data()));
3953
else if (configuration.find("Jpsi4Prong") != std::string::npos) gen->SetDecayTable(Form("%s/JPSI.4PRONG.DEC",pathO2.Data()));
4054
else if (configuration.find("Jpsi6Prong") != std::string::npos) gen->SetDecayTable(Form("%s/JPSI.6PRONG.DEC",pathO2.Data()));
55+
else if (configuration.find("Dpmjet") != std::string::npos) gen->SetDecayTable(Form("%s/OPENCHARM.DEC",pathO2.Data()));
4156

4257
return gen;
4358
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
R__LOAD_LIBRARY(NeutronGenerator_cxx.so)
2+
#include "GeneratorStarlight.C"
3+
#include "NeutronGenerator.h"
4+
5+
class Generator_nOOn_class : public o2::eventgen::GeneratorStarlight_class
6+
{
7+
public:
8+
/// constructor
9+
Generator_nOOn_class(){};
10+
/// Destructor
11+
~Generator_nOOn_class() = default;
12+
13+
bool Init() override
14+
{
15+
GeneratorStarlight_class::Init();
16+
mNeutronGen = new NeutronGenerator();
17+
mNeutronGen->SetRapidityCut(-6.0,6.0);
18+
19+
float beam1energy = TMath::Sqrt(Double_t(projZ)/projA*targA/targZ)*eCM/2;
20+
float gamma1 = beam1energy/0.938272;
21+
mNeutronGen->SetRunMode(NeutronGenerator::kInterface);
22+
mNeutronGen->SetBeamParameters(NeutronGenerator::kPb208,gamma1);
23+
mNeutronGen->SetDataPath(gSystem->ExpandPathName("$nOOn_ROOT/include/Data/"));
24+
mNeutronGen->Initialize();
25+
mNeutronGen->Setup();
26+
return true;
27+
}
28+
29+
bool generateEvent() override
30+
{
31+
GeneratorStarlight_class::generateEvent();
32+
mNeutronGen->GenerateEvent(getPhotonEnergy());
33+
return true;
34+
}
35+
36+
bool importParticles() override
37+
{
38+
GeneratorStarlight_class::importParticles();
39+
40+
mNeutrons = mNeutronGen->ImportParticles();
41+
for(Int_t i = 0; i<mNeutrons->GetEntriesFast(); i++){
42+
mParticles.push_back(*(TParticle*)(mNeutrons->At(i)));
43+
o2::mcutils::MCGenHelper::encodeParticleStatusAndTracking(mParticles.back(), true);
44+
}
45+
mNeutronGen->FinishEvent();
46+
mNeutrons->Clear("C");
47+
return true;
48+
}
49+
50+
51+
private:
52+
NeutronGenerator *mNeutronGen = 0x0;
53+
TClonesArray *mNeutrons = 0x0;
54+
55+
};
56+
57+
///___________________________________________________________
58+
FairGenerator *Generator_nOOn(std::string configuration = "empty",float energyCM = 5020, int beam1Z = 82, int beam1A = 208, int beam2Z = 82, int beam2A = 208, std::string extrapars = "")
59+
{
60+
auto gen = new Generator_nOOn_class();
61+
gen->selectConfiguration(configuration);
62+
gen->setCollisionSystem(energyCM, beam1Z, beam1A, beam2Z, beam2A);
63+
gen->setExtraParams(extrapars);
64+
return gen;
65+
}

MC/config/PWGUD/ini/makeStarlightConfig.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@
3030
parser.add_argument('--dpmjetConf', default='',
3131
help='DPMJET config file')
3232

33+
parser.add_argument('--nOOn', action='store_true',
34+
help="Enable the neutron production with nOOn")
35+
3336

3437
args = parser.parse_args()
3538

39+
if args.nOOn:
40+
args.extraPars = 'BREAKUP_MODE = 4'
41+
3642
if 'PbPb' in args.collType:
3743
pZ = 82
3844
pA = 208
@@ -74,12 +80,16 @@
7480

7581
### Generator
7682
fout.write('[GeneratorExternal] \n')
77-
if 'Psi2sToMuPi' in args.process or 'Psi2sToElPi' in args.process or 'OmegaTo3Pi' in args.process or 'JpsiToElRad' in args.process or 'Jpsi4Prong' in args.process or 'Jpsi6Prong' in args.process or 'kTau' in args.process:
78-
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/external/generator/GeneratorStarlightToEvtGen.C \n')
79-
fout.write('funcName = GeneratorStarlightToEvtGen("%s", %f, %d, %d, %d, %d, "%s") \n' % (args.process,args.eCM ,pZ,pA,tZ,tA,args.extraPars))
83+
if args.nOOn:
84+
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/external/generator/Generator_nOOn.C \n')
85+
fout.write('funcName = Generator_nOOn("%s", %f, %d, %d, %d, %d, "%s") \n' % (args.process,args.eCM ,pZ,pA,tZ,tA,args.extraPars))
8086
else:
81-
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/external/generator/GeneratorStarlight.C \n')
82-
fout.write('funcName = GeneratorStarlight("%s", %f, %d, %d, %d, %d, "%s", "%s") \n' % (args.process.split('_')[0],args.eCM ,pZ,pA,tZ,tA,args.extraPars,args.dpmjetConf))
87+
if 'Psi2sToMuPi' in args.process or 'Psi2sToElPi' in args.process or 'OmegaTo3Pi' in args.process or 'JpsiToElRad' in args.process or 'Jpsi4Prong' in args.process or 'Jpsi6Prong' in args.process or 'kTau' in args.process or 'Dpmjet' in args.process:
88+
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/external/generator/GeneratorStarlightToEvtGen.C \n')
89+
fout.write('funcName = GeneratorStarlightToEvtGen("%s", %f, %d, %d, %d, %d, "%s", "%s") \n' % (args.process.split('_')[0],args.eCM ,pZ,pA,tZ,tA,args.extraPars,args.dpmjetConf))
90+
else:
91+
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/external/generator/GeneratorStarlight.C \n')
92+
fout.write('funcName = GeneratorStarlight("%s", %f, %d, %d, %d, %d, "%s", "%s") \n' % (args.process.split('_')[0],args.eCM ,pZ,pA,tZ,tA,args.extraPars,args.dpmjetConf))
8393

8494
###Trigger
8595
if not 'kDpmjet' in args.process:

MC/config/PWGUD/trigger/selectParticlesInAcceptance.C

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ o2::eventgen::Trigger selectMotherPartInAcc(double rapidityMin = -1., double rap
1010
{
1111
return [rapidityMin, rapidityMax](const std::vector<TParticle>& particles) -> bool {
1212
for (const auto& particle : particles) {
13+
if (TMath::Abs(particle.GetPdgCode()) == 2112)continue;
1314
if (particle.GetFirstMother() == -1)
1415
if ((particle.Y() > rapidityMin) && (particle.Y() < rapidityMax))
1516
return kTRUE;
@@ -22,6 +23,7 @@ o2::eventgen::Trigger selectDaughterPartInAcc(double etaMin = -1., double etaMax
2223
{
2324
return [etaMin, etaMax](const std::vector<TParticle>& particles) -> bool {
2425
for (const auto& particle : particles) {
26+
if (TMath::Abs(particle.GetPdgCode()) == 2112)continue;
2527
if (particle.GetFirstMother() == -1)
2628
if ((particle.Y() < etaMin) || (particle.Y() > etaMax)) return kFALSE;
2729
if (particle.GetFirstMother() != -1 && particle.GetFirstDaughter() == -1 && particle.GetPdgCode() != 22 && TMath::Abs(particle.GetPdgCode()) != 12 && TMath::Abs(particle.GetPdgCode()) != 14 && TMath::Abs(particle.GetPdgCode()) != 16)

MC/config/PWGUD/trigger/triggerDpmjetParticle.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ o2::eventgen::Trigger triggerDstar(double rapidityMin = -1., double rapidityMax
3434
{
3535
return [rapidityMin, rapidityMax](const std::vector<TParticle>& particles) -> bool {
3636
for (const auto& particle : particles) {
37-
if ((TMath::Abs(particle.GetPdgCode()) == 413) || (TMath::Abs(particle.GetPdgCode()) == 423))
37+
if (TMath::Abs(particle.GetPdgCode()) == 413)
3838
if ((particle.Y() > rapidityMin) && (particle.Y() < rapidityMax))
3939
return kTRUE;
4040
}

0 commit comments

Comments
 (0)