-
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
* provided "as is" without express or implied warranty. *
**************************************************************************/
+// Pythia 6 interface used by AliGenPythia
+// Some settings are done by AliGenPythia, others here :)
+//
/* $Id$ */
#include "AliPythia.h"
#include "AliPythiaRndm.h"
#include "AliFastGlauber.h"
#include "AliQuenchingWeights.h"
+#include "AliOmegaDalitz.h"
+#include "AliDecayerExodus.h"
+#include "AliLog.h"
#include "TVector3.h"
+#include "TLorentzVector.h"
#include "PyquenCommon.h"
ClassImp(AliPythia)
# define pyquen pyquen_
# define pyevnw pyevnw_
# define pyshowq pyshowq_
+# define qpygin0 qpygin0_
# define pytune pytune_
# define py2ent py2ent_
+# define setpowwght setpowwght_
# define type_of_call
#else
# define pyclus PYCLUS
# define pyquen PYQUEN
# define pyevnw PYEVNW
# define pyshowq PYSHOWQ
+# define qpygin0 QPYGIN0
# define pytune PYTUNE
# define py2ent PY2ENT
+# define setpowwght SETPOWWGHT
# define type_of_call _stdcall
#endif
extern "C" void type_of_call pyshow(Int_t &, Int_t &, Double_t &);
extern "C" void type_of_call pyrobo(Int_t &, Int_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &);
extern "C" void type_of_call pyquen(Double_t &, Int_t &, Double_t &);
-extern "C" void type_of_call pyevnw(){;}
+extern "C" void type_of_call pyevnw();
extern "C" void type_of_call pyshowq(Int_t &, Int_t &, Double_t &);
extern "C" void type_of_call pytune(Int_t &);
extern "C" void type_of_call py2ent(Int_t &, Int_t&, Int_t&, Double_t&);
-
+extern "C" void type_of_call qpygin0();
+extern "C" void type_of_call setpowwght(Double_t &);
//_____________________________________________________________________________
AliPythia* AliPythia::fgAliPythia=NULL;
fProcess(kPyMb),
fEcms(0.),
fStrucFunc(kCTEQ5L),
+ fProjectile("p"),
+ fTarget("p"),
fXJet(0.),
fYJet(0.),
fNGmax(30),
fZmax(0.97),
fGlauber(0),
fQuenchingWeights(0),
- fItune(-1)
+ fItune(-1),
+ fOmegaDalitz(),
+ fExodus()
{
// Default Constructor
//
AliPythiaRndm::SetPythiaRandom(GetRandom());
fGlauber = 0;
fQuenchingWeights = 0;
+ Int_t i = 0;
+ for (i = 0; i < 501; i++) fDefMDCY[i] = 0;
+ for (i = 0; i < 2001; i++) fDefMDME[i] = 0;
+ for (i = 0; i < 4; i++) fZQuench[i] = 0;
}
AliPythia::AliPythia(const AliPythia& pythia):
fProcess(kPyMb),
fEcms(0.),
fStrucFunc(kCTEQ5L),
+ fProjectile("p"),
+ fTarget("p"),
fXJet(0.),
fYJet(0.),
fNGmax(30),
fZmax(0.97),
fGlauber(0),
fQuenchingWeights(0),
- fItune(-1)
+ fItune(-1),
+ fOmegaDalitz(),
+ fExodus()
{
// Copy Constructor
+ Int_t i;
+ for (i = 0; i < 501; i++) fDefMDCY[i] = 0;
+ for (i = 0; i < 2001; i++) fDefMDME[i] = 0;
+ for (i = 0; i < 4; i++) fZQuench[i] = 0;
pythia.Copy(*this);
}
SetMDCY(Pycomp(310) ,1,0); // K0S
SetMDCY(Pycomp(3122),1,0); // kLambda
SetMDCY(Pycomp(3112),1,0); // sigma -
- SetMDCY(Pycomp(3212),1,0); // sigma 0
SetMDCY(Pycomp(3222),1,0); // sigma +
SetMDCY(Pycomp(3312),1,0); // xi -
SetMDCY(Pycomp(3322),1,0); // xi 0
SetMSUB(94,1); // double diffraction
SetMSUB(95,1); // low pt production
- AtlasTuning_MC09();
+ AtlasTuningMC09();
break;
case kPyMbWithDirectPhoton:
// QCD Jets
//
SetMSEL(1);
+
// Pythia Tune A (CDF)
//
- SetPARP(67,2.5); // Regulates Initial State Radiation (value from best fit to D0 dijet analysis)
- SetMSTP(82,4); // Double Gaussian Model
- SetPARP(82,2.0); // [GeV] PT_min at Ref. energy
- SetPARP(84,0.4); // Core radius
- SetPARP(85,0.90) ; // Regulates gluon prod. mechanism
- SetPARP(86,0.95); // Regulates gluon prod. mechanism
- SetPARP(89,1800.); // [GeV] Ref. energy
- SetPARP(90,0.25); // 2*epsilon (exponent in power law)
- break;
+ if (fItune < 0) {
+ SetPARP(67,2.5); // Regulates Initial State Radiation (value from best fit to D0 dijet analysis)
+ SetMSTP(82,4); // Double Gaussian Model
+ SetPARP(82,2.0); // [GeV] PT_min at Ref. energy
+ SetPARP(84,0.4); // Core radius
+ SetPARP(85,0.90) ; // Regulates gluon prod. mechanism
+ SetPARP(86,0.95); // Regulates gluon prod. mechanism
+ SetPARP(89,1800.); // [GeV] Ref. energy
+ SetPARP(90,0.25); // 2*epsilon (exponent in power law)
+ }
+ break;
case kPyDirectGamma:
SetMSEL(10);
break;
case kPyD0ppMNR:
case kPyDPlusppMNR:
case kPyDPlusStrangeppMNR:
+ case kPyLambdacppMNR:
// Tuning of Pythia parameters aimed to get a resonable agreement
// between with the NLO calculation by Mangano, Nason, Ridolfi for the
// c-cbar single inclusive and double differential distributions.
SetMSTP(71,1); //Final QCD & QED showers on
break;
-
+ case kPyZgamma:
+ //Inclusive production of Z
+ SetMSEL(0);
+ //f fbar -> Z/gamma
+ SetMSUB(1,1);
+ // Initial/final parton shower on (Pythia default)
+ // With parton showers on we are generating "Z inclusive process"
+ SetMSTP(61,1); //Initial QCD & QED showers on
+ SetMSTP(71,1); //Final QCD & QED showers on
+ break;
+ case kPyMBRSingleDiffraction:
+ case kPyMBRDoubleDiffraction:
+ case kPyMBRCentralDiffraction:
+ break;
+ case kPyJetsPWHG:
+ // N.B.
+ // ====
+ // For the case of jet production the following parameter setting
+ // limits the transverse momentum of secondary scatterings, due
+ // to multiple parton interactions, to be less than that of the
+ // primary interaction (see POWHEG Dijet paper arXiv:1012.3380
+ // [hep-ph] sec. 4.1 and also the PYTHIA Manual).
+ SetMSTP(86,1);
+
+ // maximum number of errors before pythia aborts (def=10)
+ SetMSTU(22,10);
+ // number of warnings printed on the shell
+ SetMSTU(26,20);
+ break;
+
+ case kPyCharmPWHG:
+ case kPyBeautyPWHG:
+ case kPyWPWHG:
+ // number of warnings printed on the shell
+ SetMSTU(26,20);
+
+ break;
}
//
// Initialize PYTHIA
//
// Select the tune
- if (itune > -1) Pytune(itune);
-
+ if (itune > -1) {
+ Pytune(itune);
+ if (GetMSTP(192) > 1 || GetMSTP(193) > 1) {
+ AliWarning(Form("Structure function for tune %5d set to %5s\n",
+ itune, AliStructFuncType::PDFsetName(strucfunc).Data()));
+ SetMSTP(52,2);
+ SetMSTP(51, AliStructFuncType::PDFsetIndex(strucfunc));
+ }
+ }
//
SetMSTP(41,1); // all resonance decays switched on
- Initialize("CMS","p","p",fEcms);
-
+ if (process == kPyJetsPWHG || process == kPyCharmPWHG || process == kPyBeautyPWHG || process == kPyWPWHG) {
+ Initialize("USER","","",0.);
+ } else {
+ Initialize("CMS",fProjectile,fTarget,fEcms);
+ }
+ fOmegaDalitz.Init();
+ fExodus.Init();
}
Int_t AliPythia::CheckedLuComp(Int_t kf)
// If the following mass number both not equal zero, nuclear corrections of the stf are used.
// MSTP(192) : Mass number of nucleus side 1
// MSTP(193) : Mass number of nucleus side 2
-// MSTP(194) : Nuclear structure function: 0: EKS98 1:EPS08
+// MSTP(194) : Nuclear structure function: 0: EKS98 8:EPS08 9:EPS09LO 19:EPS09NLO
SetMSTP(52,2);
SetMSTP(192, a1);
SetMSTP(193, a2);
py2ent(idx, pdg1, pdg2, p);
}
+void AliPythia::SetWeightPower(Double_t pow)
+{
+ setpowwght(pow);
+ SetMSTP(142, 1); // Tell Pythia to use pyevwt to calculate event wghts
+ if (GetCKIN(3) <= 0)
+ AliWarning("Need to set minimum p_T,hard to nonzero value for weighted event generation");
+}
void AliPythia::InitQuenching(Float_t cMin, Float_t cMax, Float_t k, Int_t iECMethod, Float_t zmax, Int_t ngmax)
{
Double_t px = 0., py = 0., pz = 0., e = 0., m = 0., p = 0., pt = 0., theta = 0., phi = 0.;
Double_t pxq[4], pyq[4], pzq[4], eq[4], yq[4], mq[4], pq[4], phiq[4], thetaq[4], ptq[4];
Bool_t quenched[4];
- Double_t wjtKick[4];
+ Double_t wjtKick[4] = {0., 0., 0., 0.};
Int_t nGluon[4];
Int_t qPdg[4];
Int_t imo, kst, pdg;
//
pyshowq(ip1, ip2, qmax);
}
+ void AliPythia::Qpygin0()
+ {
+ // New multiple interaction scenario
+ qpygin0();
+ }
void AliPythia::GetQuenchingParameters(Double_t& xp, Double_t& yp, Double_t z[4])
{
//
SetMSEL(1);
- // No multiple interactions
- SetMSTP(81,0);
- SetPARP(81, 0.);
- SetPARP(82, 0.);
+
+ if (fItune < 0) {
+ // No multiple interactions
+ SetMSTP(81,0);
+ SetPARP(81, 0.);
+ SetPARP(82, 0.);
+ }
// Initial/final parton shower on (Pythia default)
SetMSTP(61,1);
SetMSTP(71,1);
SetPARP(67,1); // Regulates Initial State Radiation
}
-void AliPythia::AtlasTuning_MC09()
+void AliPythia::AtlasTuningMC09()
{
//
// Configuration for the ATLAS tuning
Fatal("Copy","Not implemented!\n");
}
+void AliPythia::DalitzDecays()
+{
+
+ //
+ // Replace all omega dalitz decays with the correct matrix element decays
+ //
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 223) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 2) continue;
+ if ((fPyjets->K[1][fd] != 111) ||
+ ((TMath::Abs(fPyjets->K[1][fd+1]) != 11) && (TMath::Abs(fPyjets->K[1][fd+1]) != 13)))
+ continue;
+ TLorentzVector omega(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][fd+1]);
+ fOmegaDalitz.Decay(pdg, &omega);
+ for (Int_t j = 0; j < 3; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fOmegaDalitz.Products())[2-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+
+//
+// Replace all dalitz(pi0,eta,omega,eta',phi) and resonance(rho,omega,phi,jpsi) decays with the correct matrix element decays
+// for di-electron cocktail calculations
+//
+
+
+void AliPythia::PizeroDalitz()
+{
+
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 111) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 2) continue;
+ if ((fPyjets->K[1][fd] != 22) || (TMath::Abs(fPyjets->K[1][fd+1]) != 11) )
+ continue;
+ TLorentzVector pizero(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][i]);
+ fExodus.Decay(pdg, &pizero);
+ for (Int_t j = 0; j < 3; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fExodus.Products_pion())[2-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+
+void AliPythia::EtaDalitz()
+{
+
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 221) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 2) continue;
+ if ((fPyjets->K[1][fd] != 22) || (TMath::Abs(fPyjets->K[1][fd+1]) != 11))
+ continue;
+ TLorentzVector eta(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][i]);
+ fExodus.Decay(pdg, &eta);
+ for (Int_t j = 0; j < 3; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fExodus.Products_eta())[2-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+
+void AliPythia::RhoDirect()
+{
+
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 113) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 1) continue;
+ if ((TMath::Abs(fPyjets->K[1][fd]) != 11))
+ continue;
+ TLorentzVector rho(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][i]);
+ fExodus.Decay(pdg, &rho);
+ for (Int_t j = 0; j < 2; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fExodus.Products_rho())[1-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+
+void AliPythia::OmegaDalitz()
+{
+
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 223) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 2) continue;
+ if ((fPyjets->K[1][fd] != 111) || (TMath::Abs(fPyjets->K[1][fd+1]) != 11))
+ continue;
+ TLorentzVector omegadalitz(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][i]);
+ fExodus.Decay(pdg, &omegadalitz);
+ for (Int_t j = 0; j < 3; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fExodus.Products_omega_dalitz())[2-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+
+void AliPythia::OmegaDirect()
+{
+
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 223) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 1) continue;
+ if ((TMath::Abs(fPyjets->K[1][fd]) != 11))
+ continue;
+ TLorentzVector omegadirect(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][i]);
+ fExodus.Decay(pdg, &omegadirect);
+ for (Int_t j = 0; j < 2; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fExodus.Products_omega())[1-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+
+void AliPythia::EtaprimeDalitz()
+{
+
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 331) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 2) continue;
+ if ((fPyjets->K[1][fd] != 22) || (TMath::Abs(fPyjets->K[1][fd+1]) != 11))
+ continue;
+ TLorentzVector etaprime(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][i]);
+ fExodus.Decay(pdg, &etaprime);
+ for (Int_t j = 0; j < 3; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fExodus.Products_etaprime())[2-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+
+void AliPythia::PhiDalitz()
+{
+
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 333) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 2) continue;
+ if ((fPyjets->K[1][fd] != 221) || (TMath::Abs(fPyjets->K[1][fd+1]) != 11))
+ continue;
+ TLorentzVector phidalitz(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][i]);
+ fExodus.Decay(pdg, &phidalitz);
+ for (Int_t j = 0; j < 3; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fExodus.Products_phi_dalitz())[2-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+
+void AliPythia::PhiDirect()
+{
+
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 333) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 1) continue;
+ if ((TMath::Abs(fPyjets->K[1][fd]) != 11))
+ continue;
+ TLorentzVector phi(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][i]);
+ fExodus.Decay(pdg, &phi);
+ for (Int_t j = 0; j < 2; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fExodus.Products_phi())[1-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+void AliPythia::JPsiDirect()
+{
+
+ Int_t nt = fPyjets->N;
+ for (Int_t i = 0; i < nt; i++) {
+ if (fPyjets->K[1][i] != 443) continue;
+ Int_t fd = fPyjets->K[3][i] - 1;
+ Int_t ld = fPyjets->K[4][i] - 1;
+ if (fd < 0) continue;
+ if ((ld - fd) != 1) continue;
+ if ((TMath::Abs(fPyjets->K[1][fd]) != 11))
+ continue;
+ TLorentzVector jpsi(fPyjets->P[0][i], fPyjets->P[1][i], fPyjets->P[2][i], fPyjets->P[3][i]);
+ Int_t pdg = TMath::Abs(fPyjets->K[1][i]);
+ fExodus.Decay(pdg, &jpsi);
+ for (Int_t j = 0; j < 2; j++) {
+ for (Int_t k = 0; k < 4; k++) {
+ TLorentzVector vec = (fExodus.Products_jpsi())[1-j];
+ fPyjets->P[k][fd+j] = vec[k];
+ }
+ }
+ }
+}
+
+