Skip to content

Commit 8cb3cbc

Browse files
pbuehlersawenzel
authored andcommitted
Minor updates of upcgen and graniitti generators and related scripts
1 parent a1839e7 commit 8cb3cbc

File tree

5 files changed

+42
-21
lines changed

5 files changed

+42
-21
lines changed

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

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
namespace o2 {
2-
namespace eventgen {
3-
class GeneratorGraniitti_class : public Generator {
4-
public:
1+
namespace o2
2+
{
3+
namespace eventgen
4+
{
5+
class GeneratorGraniitti_class : public Generator
6+
{
7+
public:
58
GeneratorGraniitti_class() { };
69
~GeneratorGraniitti_class() = default;
710
bool setJsonFile(std::string fname) {
@@ -59,26 +62,44 @@ public:
5962
};
6063

6164
bool generateEvent() override {
62-
return reader->generateEvent();
65+
if (reader->generateEvent()) {
66+
return true;
67+
} else {
68+
std::cout << "New file needs to be generated.";
69+
delete reader;
70+
createHepMCFile();
71+
openHepMCFile();
72+
return reader->generateEvent();
73+
}
6374
};
6475

6576
bool importParticles() override {
6677
mParticles.clear();
6778
if (!reader->importParticles()) {
6879
return false;
6980
}
70-
printParticles();
71-
81+
for (auto part : reader->getParticles()) {
82+
TParticle particle(part.GetPdgCode(),
83+
1,
84+
part.GetFirstMother(),
85+
-1,
86+
part.GetFirstDaughter(),
87+
part.GetLastDaughter(),
88+
part.Px(),
89+
part.Py(),
90+
part.Pz(),
91+
part.Energy(),
92+
0.,
93+
0.,
94+
0.,
95+
0.);
96+
mParticles.push_back(particle);
97+
o2::mcutils::MCGenHelper::encodeParticleStatusAndTracking(
98+
mParticles.back(), true);
99+
}
72100
return true;
73101
};
74102

75-
void printParticles()
76-
{
77-
std::cout << "\n\n";
78-
for (auto& particle : reader->getParticles())
79-
particle.Print();
80-
}
81-
82103
private:
83104
o2::eventgen::GeneratorHepMC *reader = 0x0;
84105
std::string jsonFile;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public:
118118
std::cout << "\n";
119119
auto upcgenParticles = mUPCgen->getParticles();
120120
for (auto part : upcgenParticles) {
121-
part.Print();
122121
TParticle particle(part.GetPdgCode(), 1, part.GetFirstMother(), -1,
123122
part.GetFirstDaughter(), part.GetLastDaughter(),
124123
part.Px(), part.Py(), part.Pz(), part.Energy(), 0., 0.,

MC/config/PWGUD/ini/makeGraniittiConfig.py

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def createJson(args):
8484
return jsonFile
8585

8686
# main
87-
8887
parser = argparse.ArgumentParser(description='Make Graniitti configuration',
8988
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
9089

@@ -118,7 +117,7 @@ def createJson(args):
118117

119118
###Trigger
120119
fout.write('[TriggerExternal] \n')
121-
fout.write('fileName = ${O2DPG_ROOT}/MC/config/PWGUD/trigger/selectParticlesInAcceptance.C \n')
120+
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/trigger/selectParticlesInAcceptance.C \n')
122121
if args.rapidity == 'cent_rap':
123122
fout.write('funcName = selectMotherPartInAcc(-0.9,0.9) \n')
124123
if args.rapidity == 'muon_rap':

MC/config/PWGUD/trigger/selectParticlesInAcceptance.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ o2::eventgen::Trigger selectDaughterPartInAcc(double etaMin = -1., double etaMax
2525
if (particle.GetFirstMother() == -1)
2626
if ((particle.Y() < etaMin) || (particle.Y() > etaMax)) return kFALSE;
2727
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)
28-
if ((particle.Eta() < etaMin) || (particle.Eta() > etaMax)) return kFALSE;
28+
if ((particle.Eta() < etaMin) || (particle.Eta() > etaMax)) return kFALSE;
2929
}
3030
return kTRUE;
3131
};

MC/run/PWGUD/runGraniittiANCHOR.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ export PRODSPLIT=100
2121
export CYCLE=30
2222
export ALIEN_PROC_ID=2963436952
2323

24-
25-
#export ALIEN_JDL_ANCHOR_SIM_OPTIONS="-gen external -ini ${PWD}/GenGraniitti.ini --embedding -nb ${NBKGEVENTS} -colBkg PbPb -genBkg pythia8 -procBkg heavy_ion"
26-
24+
# create generator config file
2725
${O2DPG_ROOT}/MC/config/PWGUD/ini/makeGraniittiConfig.py --process kConRes_pipi --eCM 13600 --nEvents 300 --rapidity cent_eta
26+
27+
# set sim options
2828
export ALIEN_JDL_ANCHOR_SIM_OPTIONS="-gen external -ini ${PWD}/GenGraniitti.ini"
29+
#export ALIEN_JDL_ANCHOR_SIM_OPTIONS="-gen external -ini ${PWD}/GenGraniitti.ini --embedding -nb ${NBKGEVENTS} -colBkg PbPb -genBkg pythia8 -procBkg heavy_ion"
2930

31+
# run anchored simulations
3032
${O2DPG_ROOT}/MC/run/ANCHOR/anchorMC.sh

0 commit comments

Comments
 (0)