Skip to content

Commit

Permalink
Merge pull request #523 from mauro-cosentino/master
Browse files Browse the repository at this point in the history
Including option for gamma-jet events, gamma in focal (agreed with Io…
  • Loading branch information
gconesab authored Oct 29, 2022
2 parents 85eccfd + edc09ac commit e8a85f1
Showing 1 changed file with 41 additions and 95 deletions.
136 changes: 41 additions & 95 deletions MC/CustomGenerators/Upgrade/FOCAL_Generators.C
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Double_t EtaToTheta(Double_t eta)
enum GenTypes {
gun=0,
gunJpsi,
box,
boxWithDecay,
box,
pythia,
pythia_MBtrig,
pythia_dirgamma_trig,
pythia_dirgamma_trig,
pythia_gammajet_trig,
ntuple,
hijing,
hijingAP,
Expand All @@ -26,10 +26,10 @@ TString gGenTypeNames[kNGenTypes] = {
"gun",
"gunJpsi",
"box",
"boxWithDecay",
"pythia",
"pythia_MBtrig",
"pythia_dirgamma_trig",
"pythia_gammajet_trig",
"ntuple",
"hijing",
"hijingAP",
Expand Down Expand Up @@ -185,82 +185,6 @@ AliGenerator* GeneratorCustom(TString opt = "") {
generator = gener;
}
break;

case boxWithDecay:
// Example for Moving Particle Gun (with decays enabled)
{
float ptmin = 0.0;
if (gSystem->Getenv("CONFIG_PTMIN")) {
ptmin = atof(gSystem->Getenv("CONFIG_PTMIN"));
}
float ptmax = 10.0;
if (gSystem->Getenv("CONFIG_PTMAX")) {
ptmax = atof(gSystem->Getenv("CONFIG_PTMAX"));
}
float ymin = 3.0;
if (gSystem->Getenv("CONFIG_YMIN")) {
ymin = atof(gSystem->Getenv("CONFIG_YMIN"));
}
float ymax = 6.0;
if (gSystem->Getenv("CONFIG_YMAX")) {
ymax = atof(gSystem->Getenv("CONFIG_YMAX"));
}
float phimin = 0.0;
if (gSystem->Getenv("CONFIG_PHIMIN")) {
phimin = atof(gSystem->Getenv("CONFIG_PHIMIN"));
}
float phimax = 360.0;
if (gSystem->Getenv("CONFIG_PHIMAX")) {
phimax = atof(gSystem->Getenv("CONFIG_PHIMAX"));
}
int pdg = 23; // default: Z0
if (gSystem->Getenv("CONFIG_PDG")) {
pdg = atoi(gSystem->Getenv("CONFIG_PDG"));
}

// set external decayer
TVirtualMCDecayer* decayer = new AliDecayerPythia();
decayer->SetForceDecay(kAll);
decayer->Init();
gMC->SetExternalDecayer(decayer);

AliGenCocktail *gener = new AliGenCocktail();
gener->UsePerEventRates();

AliGenBox *genBox = new AliGenBox(1);
genBox->SetPtRange(ptmin, ptmax);
genBox->SetPhiRange(phimin, phimax); // full polar angle around beam axis
genBox->SetYRange(ymin, ymax);
genBox->SetOrigin(0,0,0);
//vertex position
genBox->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
genBox->SetPart(pdg);
gener->AddGenerator(genBox, "box", 1.);

AliGenEvtGen *gene = new AliGenEvtGen();
// NOTE: the original decay table is in AliRoot/TEvtGen/EvtGen/DecayTable/DIELECTRON.DEC
// If the decay you are after is there, then you can comment out the following line.
// Alternatively, make sure the decay file you use below is in the working directory (or copied to
// the grid working note if you run on the grid)
gene->SetUserDecayTable("DIELECTRON.DEC");
if (pdg==23) {
gene->SetForceDecay(kZDiElectron);
gene->SetParticleSwitchedOff(AliGenEvtGen::kAllPart);
}
if (pdg==443) {
gene->SetForceDecay(kDiElectron);
gene->SetParticleSwitchedOff(AliGenEvtGen::kCharmPart);
}
if (pdg==553) {
gene->SetForceDecay(kDiElectron);
gene->SetParticleSwitchedOff(AliGenEvtGen::kCharmPart);
}
gene->Init();
gener->AddGenerator(gene, "EvtGen", 1.);

generator = gener;
}
break;

case pythia:
// Example for Pythia
Expand Down Expand Up @@ -318,15 +242,42 @@ AliGenerator* GeneratorCustom(TString opt = "") {
}
gener->SetCheckFOCAL(kTRUE);
gener->SetFOCALEta(3.5, 6.2);
float ptmin = 4.0;
if (gSystem->Getenv("CONFIG_PTMIN")) {
ptmin = atof(gSystem->Getenv("CONFIG_PTMIN"));
}
gener->SetTriggerParticleMinPt(ptmin);
gener->SetTriggerParticleMinPt(4.0);
generator = gener;
}
break;

case pythia_gammajet_trig:
// Example for Pythia
{
float energy = 14000; // GeV
if (gSystem->Getenv("CONFIG_ENERGY")) {
energy = atof(gSystem->Getenv("CONFIG_ENERGY"));
}

AliGenPythiaFOCAL *gener = new AliGenPythiaFOCAL(-1);
gener->SetMomentumRange(0,999999);
gener->SetThetaRange(0., 45.);
gener->SetYRange(-12,12);
gener->SetPtRange(0,1000);
gener->SetEnergyCMS(energy); // LHC energy
//gener->SetOrigin(0, 0, 0); // Vertex position
gener->SetSigma(0, 0, 5.3); // Sigma in (X,Y,Z) (cm) on IP position
gener->SetCutVertexZ(1.); // Truncate at 1 sigma
gener->SetVertexSmear(kPerEvent); // Smear per event
gener->SetTrackingFlag(1); // Particle transport
//gener->SetEtaInFOCAL(kTRUE);
//gener->SetPi0InFOCAL(kTRUE);
gener->SetProcess(kPyDirectGamma);
gener->SetDirPhotonInFOCAL(kTRUE);

gener->SetCheckFOCAL(kTRUE);
gener->SetFOCALEta(3.5, 6.2);
gener->SetTriggerParticleMinPt(4.0);
generator = gener;
}
break;

case ntuple:
// Example for reading from a external file *
{
Expand Down Expand Up @@ -386,7 +337,7 @@ AliGenerator* GeneratorCustom(TString opt = "") {
gener->SetSpectators(0); // Don't track spectators
gener->SetSelectAll(0); // kinematic selection
gener->SetImpactParameterRange(0., 8.); // Impact parameter range (fm)
gener->UnsetDataDrivenSpectators();
//gener->UnsetDataDrivenSpectators();

gener->SetTrigger(2); // 2: direct photons; 3: decay photons
gener->SetPtJet(4.);
Expand Down Expand Up @@ -474,23 +425,18 @@ AliGenerator* GeneratorCustom(TString opt = "") {

/*TString fifoname("$TMPDIR/myfifo");
AliGenExtExec* eposExt = new AliGenExtExec();
//eposExt->SetPathScript(Form("./gen_eposlhc.sh %s",fifoname.Data()));
eposExt->SetPathScript(Form("crmc -o hepmc -f %s -n %d -m 0 -i %d -p %f -I %d -P %f",
fifoname.Data(),nEvents,projectileId,projectileEnergy,targetId,targetEnergy));
eposExt->SetPathScript(Form("./gen_eposlhc.sh %s",fifoname.Data()));
eposExt->SetPathFIFO(fifoname);
cocktail->AddGenerator(eposExt,"EPOS",1.);*/

TString fifoname("myfifo");
gROOT->ProcessLine(Form(".! rm -rf %s", fifoname.Data()));
gROOT->ProcessLine(Form(".! mkfifo %s", fifoname.Data()));
/*gROOT->ProcessLine(Form(".! bash $ALIDPG_ROOT/MC/EXTRA/gen_eposlhc.sh %s %d %d %f %d %f &> gen_eposlhc%d.log &",
gROOT->ProcessLine(Form(".! bash $ALIDPG_ROOT/MC/EXTRA/gen_eposlhc.sh %s %d %d %f %d %f &> gen_eposlhc%d.log &",
fifoname.Data(), nEvents,
projectileId, projectileEnergy,
targetId, targetEnergy, pileup));*/
gROOT->ProcessLine(Form(".! crmc -o hepmc -f %s -n %d -m 0 -i %d -p %f -I %d -P %f &> gen_eposlhc.log &",
fifoname.Data(), nEvents,
projectileId, projectileEnergy,
targetId, targetEnergy));
targetId, targetEnergy, pileup));

// connect HepMC reader
AliGenReaderHepMC *reader = new AliGenReaderHepMC();
reader->SetFileName(fifoname.Data());
Expand Down

0 comments on commit e8a85f1

Please sign in to comment.