Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 35 additions & 14 deletions MC/config/PWGUD/external/generator/GeneratorGraniitti.C
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
namespace o2 {
namespace eventgen {
class GeneratorGraniitti_class : public Generator {
public:
namespace o2
{
namespace eventgen
{
class GeneratorGraniitti_class : public Generator
{
public:
GeneratorGraniitti_class() { };
~GeneratorGraniitti_class() = default;
bool setJsonFile(std::string fname) {
Expand Down Expand Up @@ -59,26 +62,44 @@ public:
};

bool generateEvent() override {
return reader->generateEvent();
if (reader->generateEvent()) {
return true;
} else {
std::cout << "New file needs to be generated.";
delete reader;
createHepMCFile();
openHepMCFile();
return reader->generateEvent();
}
};

bool importParticles() override {
mParticles.clear();
if (!reader->importParticles()) {
return false;
}
printParticles();

for (auto part : reader->getParticles()) {
TParticle particle(part.GetPdgCode(),
1,
part.GetFirstMother(),
-1,
part.GetFirstDaughter(),
part.GetLastDaughter(),
part.Px(),
part.Py(),
part.Pz(),
part.Energy(),
0.,
0.,
0.,
0.);
mParticles.push_back(particle);
o2::mcutils::MCGenHelper::encodeParticleStatusAndTracking(
mParticles.back(), true);
}
return true;
};

void printParticles()
{
std::cout << "\n\n";
for (auto& particle : reader->getParticles())
particle.Print();
}

private:
o2::eventgen::GeneratorHepMC *reader = 0x0;
std::string jsonFile;
Expand Down
1 change: 0 additions & 1 deletion MC/config/PWGUD/external/generator/GeneratorUpcgen.C
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public:
std::cout << "\n";
auto upcgenParticles = mUPCgen->getParticles();
for (auto part : upcgenParticles) {
part.Print();
TParticle particle(part.GetPdgCode(), 1, part.GetFirstMother(), -1,
part.GetFirstDaughter(), part.GetLastDaughter(),
part.Px(), part.Py(), part.Pz(), part.Energy(), 0., 0.,
Expand Down
3 changes: 1 addition & 2 deletions MC/config/PWGUD/ini/makeGraniittiConfig.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def createJson(args):
return jsonFile

# main

parser = argparse.ArgumentParser(description='Make Graniitti configuration',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

Expand Down Expand Up @@ -118,7 +117,7 @@ def createJson(args):

###Trigger
fout.write('[TriggerExternal] \n')
fout.write('fileName = ${O2DPG_ROOT}/MC/config/PWGUD/trigger/selectParticlesInAcceptance.C \n')
fout.write('fileName = ${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGUD/trigger/selectParticlesInAcceptance.C \n')
if args.rapidity == 'cent_rap':
fout.write('funcName = selectMotherPartInAcc(-0.9,0.9) \n')
if args.rapidity == 'muon_rap':
Expand Down
2 changes: 1 addition & 1 deletion MC/config/PWGUD/trigger/selectParticlesInAcceptance.C
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ o2::eventgen::Trigger selectDaughterPartInAcc(double etaMin = -1., double etaMax
if (particle.GetFirstMother() == -1)
if ((particle.Y() < etaMin) || (particle.Y() > etaMax)) return kFALSE;
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)
if ((particle.Eta() < etaMin) || (particle.Eta() > etaMax)) return kFALSE;
if ((particle.Eta() < etaMin) || (particle.Eta() > etaMax)) return kFALSE;
}
return kTRUE;
};
Expand Down
8 changes: 5 additions & 3 deletions MC/run/PWGUD/runGraniittiANCHOR.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ export PRODSPLIT=100
export CYCLE=30
export ALIEN_PROC_ID=2963436952


#export ALIEN_JDL_ANCHOR_SIM_OPTIONS="-gen external -ini ${PWD}/GenGraniitti.ini --embedding -nb ${NBKGEVENTS} -colBkg PbPb -genBkg pythia8 -procBkg heavy_ion"

# create generator config file
${O2DPG_ROOT}/MC/config/PWGUD/ini/makeGraniittiConfig.py --process kConRes_pipi --eCM 13600 --nEvents 300 --rapidity cent_eta

# set sim options
export ALIEN_JDL_ANCHOR_SIM_OPTIONS="-gen external -ini ${PWD}/GenGraniitti.ini"
#export ALIEN_JDL_ANCHOR_SIM_OPTIONS="-gen external -ini ${PWD}/GenGraniitti.ini --embedding -nb ${NBKGEVENTS} -colBkg PbPb -genBkg pythia8 -procBkg heavy_ion"

# run anchored simulations
${O2DPG_ROOT}/MC/run/ANCHOR/anchorMC.sh
Loading