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
3 changes: 2 additions & 1 deletion Generators/src/BoxGenerator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ TParticle o2::eventgen::BoxGenerator::sampleParticle() const
// if SetCosTheta() function is used, the distribution will be uniform in
// cos(theta)

static double mass = GetPDGMass(mPDG);
// per instance, since several box generators with different PDG codes can coexist
const double mass = GetPDGMass(mPDG);

double pabs = 0, phi, pt = 0, theta = 0, eta, y, mt, px, py, pz = 0;
phi = gRandom->Uniform(mPhiMin, mPhiMax) * TMath::DegToRad();
Expand Down
19 changes: 5 additions & 14 deletions Generators/src/GeneratorFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <SimulationDataFormat/O2DatabasePDG.h>
#include <Generators/GeneratorFactory.h>
#include "FairGenerator.h"
#include "FairBoxGenerator.h"
#include <Generators/BoxGenerator.h>
#include <fairlogger/Logger.h>
#include <SimConfig/SimConfig.h>
#include <Generators/GeneratorFromFile.h>
Expand Down Expand Up @@ -60,13 +60,8 @@ void GeneratorFactory::setPrimaryGenerator(o2::conf::SimConfig const& conf, Fair

auto primGenO2 = dynamic_cast<PrimaryGenerator*>(primGen);

auto makeBoxGen = [](int pdgid, int mult, double etamin, double etamax, double pmin, double pmax, double phimin, double phimax, bool debug = false) {
auto gen = new FairBoxGenerator(pdgid, mult);
gen->SetEtaRange(etamin, etamax);
gen->SetPRange(pmin, pmax);
gen->SetPhiRange(phimin, phimax);
gen->SetDebug(debug);
return gen;
auto makeBoxGen = [](int pdgid, int mult, double etamin, double etamax, double pmin, double pmax, double phimin, double phimax) {
return new o2::eventgen::BoxGenerator(pdgid, mult, etamin, etamax, pmin, pmax, phimin, phimax);
};

#ifdef GENERATORS_WITH_PYTHIA8
Expand Down Expand Up @@ -105,7 +100,7 @@ void GeneratorFactory::setPrimaryGenerator(o2::conf::SimConfig const& conf, Fair
auto& boxparam = BoxGunParam::Instance();
LOG(info) << "Init generic box generator with following parameters";
LOG(info) << boxparam;
auto boxGen = makeBoxGen(boxparam.pdg, boxparam.number, boxparam.eta[0], boxparam.eta[1], boxparam.prange[0], boxparam.prange[1], boxparam.phirange[0], boxparam.phirange[1], boxparam.debug);
auto boxGen = makeBoxGen(boxparam.pdg, boxparam.number, boxparam.eta[0], boxparam.eta[1], boxparam.prange[0], boxparam.prange[1], boxparam.phirange[0], boxparam.phirange[1]);
primGen->AddGenerator(boxGen);
} else if (genconfig.compare("fwmugen") == 0) {
// a simple "box" generator for forward muons
Expand Down Expand Up @@ -267,11 +262,7 @@ void GeneratorFactory::setPrimaryGenerator(o2::conf::SimConfig const& conf, Fair
LOG(info) << "Init tof test generator -> 1 muon per sector and per module";
for (int i = 0; i < 18; i++) {
for (int j = 0; j < 5; j++) {
auto boxGen = new FairBoxGenerator(13, 1); /*protons*/
boxGen->SetEtaRange(-0.8 + 0.32 * j + 0.15, -0.8 + 0.32 * j + 0.17);
boxGen->SetPRange(9, 10);
boxGen->SetPhiRange(10 + 20. * i - 1, 10 + 20. * i + 1);
boxGen->SetDebug(kTRUE);
auto boxGen = makeBoxGen(13 /*muons*/, 1, -0.8 + 0.32 * j + 0.15, -0.8 + 0.32 * j + 0.17, 9, 10, 10 + 20. * i - 1, 10 + 20. * i + 1);
primGen->AddGenerator(boxGen);
}
}
Expand Down