diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a6d1ee..8d03796 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ add_subdirectory(TEPEMGEN) add_subdirectory(GeneratorCosmics) +add_subdirectory(GeneratorParam) + if (DEFINED ENV{HIJING_ROOT}) add_subdirectory(THijing) endif (DEFINED ENV{HIJING_ROOT}) diff --git a/GeneratorParam/CMakeLists.txt b/GeneratorParam/CMakeLists.txt new file mode 100644 index 0000000..548e5dc --- /dev/null +++ b/GeneratorParam/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.0 FATAL_ERROR) +project(GeneratorParam) + +# You need to tell CMake where to find the ROOT installation. This can be done in a number of ways: +# - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake +# - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT +list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS}) + +#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS) +find_package(ROOT REQUIRED COMPONENTS EG) + +#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY) +include(${ROOT_USE_FILE}) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.) + +set(HEADERS GeneratorParam.h GeneratorParamLibBase.h GeneratorParamMUONlib.h PythiaDecayerConfig.h) + +ROOT_GENERATE_DICTIONARY(G__GeneratorParam ${HEADERS} LINKDEF GeneratorParamLinkDef.h) + +#---Create a shared library with geneated dictionary +add_library(GeneratorParam SHARED GeneratorParam.cxx GeneratorParamLibBase.cxx GeneratorParamMUONlib.cxx PythiaDecayerConfig.cxx G__GeneratorParam.cxx) +target_link_libraries(GeneratorParam ${ROOT_LIBRARIES}) + + +set_target_properties(GeneratorParam + PROPERTIES + PUBLIC_HEADER "${HEADERS}" ) + + +install(TARGETS GeneratorParam + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include) + +if (${ROOT_VERSION} VERSION_GREATER "6.0") + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/libGeneratorParam_rdict.pcm + ${CMAKE_CURRENT_BINARY_DIR}/libGeneratorParam.rootmap + DESTINATION lib) +endif (${ROOT_VERSION} VERSION_GREATER "6.0") + +if(${CMAKE_SYSTEM} MATCHES Darwin) + set_target_properties(GeneratorParam PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") +endif(${CMAKE_SYSTEM} MATCHES Darwin) diff --git a/GeneratorParam/GeneratorParam.cxx b/GeneratorParam/GeneratorParam.cxx new file mode 100644 index 0000000..de2c474 --- /dev/null +++ b/GeneratorParam/GeneratorParam.cxx @@ -0,0 +1,959 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// Class to generate particles using paramtrized pT and y distributions. +// Distributions are obtained from pointer to object of type +// GeneratorParamLibBase. Decays are performed using Pythia. +// andreas.morsch@cern.ch + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#include + +#include "GeneratorParam.h" +#include "GeneratorParamLibBase.h" + +ClassImp(GeneratorParam) + //____________________________________________________________ + GeneratorParam::GeneratorParam() + : TGenerator() { + // Default constructor +} +//____________________________________________________________ +GeneratorParam::GeneratorParam(Int_t npart, + const GeneratorParamLibBase *Library, + Int_t param, const char *tname) + : TGenerator("GeneratorParam", "GeneratorParam"), fNpart(npart) { + // Constructor using number of particles parameterisation id and library + fName = "Param"; + fTitle = "Particle Generator using pT and y parameterisation"; + fPtParaFunc = Library->GetPt(param, tname); + fYParaFunc = Library->GetY(param, tname); + fIpParaFunc = Library->GetIp(param, tname); + fV2ParaFunc = Library->GetV2(param, tname); +} + +//____________________________________________________________ + +GeneratorParam::GeneratorParam( + Int_t npart, Int_t param, + Double_t (*PtPara)(const Double_t *, const Double_t *), + Double_t (*YPara)(const Double_t *, const Double_t *), + Double_t (*V2Para)(const Double_t *, const Double_t *), + Int_t (*IpPara)(TRandom *)) + : TGenerator("GeneratorParam", "GeneratorParam"), fNpart(npart), + fPtParaFunc(PtPara), fYParaFunc(YPara), fIpParaFunc(IpPara), + fV2ParaFunc(V2Para), fParam(param) { + // Constructor + fName = "Param"; + fTitle = "Particle Generator using pT and y parameterisation"; + SetChildMomentumRange(); + SetChildPtRange(); + SetChildPhiRange(); + SetChildThetaRange(); +} + +//____________________________________________________________ +GeneratorParam::GeneratorParam( + const char *name, Int_t npart, int pdg, + Double_t (*PtPara)(const Double_t *, const Double_t *), + Double_t (*YPara)(const Double_t *, const Double_t *), + Double_t (*V2Para)(const Double_t *, const Double_t *)) + : TGenerator("GeneratorParam", "GeneratorParam"), fNpart(npart), + fPtParaFunc(PtPara), fYParaFunc(YPara), fV2ParaFunc(V2Para), + fPDGcode(pdg) { + // Constructor + fName = name; + fTitle = + Form("Particle Generator using pT and y parameterisation for %s", name); + + SetChildMomentumRange(); + SetChildPtRange(); + SetChildPhiRange(); + SetChildThetaRange(); + fPtParaFunc = PtPara ? PtPara : [](const double *, const double *) -> double { + return 1.; + }; + fYParaFunc = YPara ? YPara : [](const double *, const double *) -> double { + return 1.; + }; + fV2ParaFunc = V2Para ? V2Para : [](const double *, const double *) -> double { + return 0.; + }; +} + +//____________________________________________________________ +GeneratorParam::~GeneratorParam() { + // Destructor + delete fPtPara; + delete fYPara; + delete fV2Para; + delete fdNdPhi; +} + +//____________________________________________________________ +void GeneratorParam::Init() { + // Initialisation + + if (!fDecayer) { + Fatal("Init", "No decayer set \n"); + } + // For AliDecayerPythia based on FORTRAN there is a known inconsitency between + // the index returned by GetFirstDaughter(), GetLastDaughter(), GetMother() + // ... and the actual position in the C++ particle list. That's the reason whe + // the offset fIncFortran = -1 is needed in this case but not for decayers + // based on C++ + + if (strcmp(fDecayer->ClassName(), "TPythia6Decayer")) + fIncFortran = -1; + char name[256]; + snprintf(name, 256, "pt-parameterisation for %s", GetName()); + + if (fPtPara) + fPtPara->Delete(); + fPtPara = new TF1(name, fPtParaFunc, fPtMin, fPtMax, 0); + gROOT->GetListOfFunctions()->Remove(fPtPara); + // Set representation precision to 10 MeV + Int_t npx = Int_t((fPtMax - fPtMin) / fDeltaPt); + fPtPara->SetNpx(npx); + + snprintf(name, 256, "y-parameterisation for %s", GetName()); + if (fYPara) + fYPara->Delete(); + fYPara = new TF1(name, fYParaFunc, fYMin, fYMax, 0); + gROOT->GetListOfFunctions()->Remove(fYPara); + + snprintf(name, 256, "v2-parameterisation for %s", GetName()); + if (fV2Para) + fV2Para->Delete(); + fV2Para = new TF1(name, fV2ParaFunc, fPtMin, fPtMax, 0); + snprintf(name, 256, "dNdPhi for %s", GetName()); + if (fdNdPhi) + fdNdPhi->Delete(); + fdNdPhi = new TF1(name, "1+2*[0]*TMath::Cos(2*(x-[1]))", fPhiMin, fPhiMax); + // + // Initialize the decayer + fDecayer->Init(); + // initialise selection of decay products + InitChildSelect(); + PythiaDecayerConfig decayerconfig; + decayerconfig.Init(fForceDecay); +} + +void GeneratorParam::GenerateEvent() { + // + // Generate one event + // + fParticles->Clear(); + // ??? fDecayer->SetForceDecay(fForceDecay); + fDecayer->Init(); + + // + Float_t polar[3] = { + 0, 0, 0}; // Polarisation of the parent particle (for GEANT tracking) + Double_t origin0[3]; // Origin of the generated parent particle (for GEANT + // tracking) + Double_t och0[3]; // Origin of child particle + Double_t pt, pl, + ptot; // Transverse, logitudinal and total momenta of the parent particle + Double_t phi, + theta; // Phi and theta spherical angles of the parent particle momentum + Double_t p[3], pc[3], och[3]; // Momentum, polarisation and origin of the + // children particles from lujet + Double_t ty, xmt; + Int_t i, j; + Double_t energy; + Float_t time0; + + std::vector vFlags; + std::vector vSelected; + std::vector vParent; + + // array to store decay products + static TClonesArray *particles; + // + if (!particles) + particles = new TClonesArray("TParticle", 1000); + + TDatabasePDG *pDataBase = TDatabasePDG::Instance(); + // + Float_t random[6]; + + Int_t ipa = 0; + + // Generating fNpart particles + fNprimaries = 0; + auto nt = 0; + while (ipa < fNpart) { + while (1) { + // + // particle type + Int_t pdg = fIpParaFunc ? fIpParaFunc(gRandom) : fPDGcode; + Int_t iTemp = pdg; + + // custom pdg codes to destinguish direct photons + if ((pdg >= 220000) && (pdg <= 220001)) + pdg = 22; + TParticlePDG *particle = pDataBase->GetParticle(pdg); + Float_t am = particle->Mass(); + gRandom->RndmArray(2, random); + + // --- For Exodus ------------------------------- + Double_t awidth = particle->Width(); + if (awidth > 0) { + TF1 rbw("rbw", + "pow([1],2)*pow([0],2)/(pow(x*x-[0]*[0],2)+pow(x*x*[1]/[0],2))", + am - 5 * awidth, am + 5 * awidth); + rbw.SetParameter(0, am); + rbw.SetParameter(1, awidth); + am = rbw.GetRandom(); + } + // -----------------------------------------------// + + // + // y + ty = TMath::TanH(fYPara->GetRandom()); + // + // pT + pt = fPtPara->GetRandom(); + xmt = sqrt(pt * pt + am * am); + if (TMath::Abs(ty) == 1.) { + ty = 0.; + Fatal("AliGenParam", + "Division by 0: Please check you rapidity range !"); + } + // + // phi + double v2 = fV2Para->Eval(pt); + fdNdPhi->SetParameter(0, v2); + fdNdPhi->SetParameter(1, fEvPlane); + phi = fdNdPhi->GetRandom(); + pl = xmt * ty / sqrt((1. - ty) * (1. + ty)); + theta = TMath::ATan2(pt, pl); + // Cut on theta + if (theta < fThetaMin || theta > fThetaMax) + continue; + ptot = TMath::Sqrt(pt * pt + pl * pl); + // Cut on momentum + if (ptot < fPMin || ptot > fPMax) + continue; + // + p[0] = pt * TMath::Cos(phi); + p[1] = pt * TMath::Sin(phi); + p[2] = pl; + energy = TMath::Sqrt(ptot * ptot + am * am); + + // if fForceDecay != none Primary particle decays using + // AliPythia and children are tracked by GEANT + // + // if fForceDecay == none Primary particle is tracked by GEANT + // (In the latest, make sure that GEANT actually does all the decays you + // want) + // + Bool_t decayed = kFALSE; + + if (fForceDecay != kNoDecay) { + // Using lujet to decay particle + TLorentzVector pmom(p[0], p[1], p[2], energy); + fDecayer->Decay(pdg, &pmom); + // + // select decay particles + Int_t np = fDecayer->ImportParticles(particles); + pdg = iTemp; + if (pdg >= 220000 & pdg <= 220001) { + TParticle *gamma = (TParticle *)particles->At(0); + gamma->SetPdgCode(pdg); + np = VirtualGammaPairProduction(particles, np); + } + if (fForceConv) + np = ForceGammaConversion(particles, np); + + auto ncsel = 0; + vFlags.reserve(np); + vFlags = {true}; + vSelected.reserve(np); + vSelected = {true}; + vParent.reserve(np); + + if (np > 1) { + decayed = kTRUE; + TParticle *iparticle = 0; + Int_t ipF, ipL; + for (i = 1; i < np; i++) { + + iparticle = (TParticle *)particles->At(i); + Int_t kf = iparticle->GetPdgCode(); + Int_t ks = iparticle->GetStatusCode(); + // flagged particle + if (!fPreserveFullDecayChain) { + if (vFlags[i]) { + ipF = iparticle->GetFirstDaughter() + fIncFortran; + ipL = iparticle->GetLastDaughter() + fIncFortran; + if (ipF > 0) + for (j = ipF; j <= ipL; j++) + vFlags[j] = true; + continue; + } + } + // flag decay products of particles with long life-time (ctau > .3 + // mum) + if (ks != 1) { + Double_t lifeTime = fDecayer->GetLifetime(kf); + if (lifeTime > (Double_t)fMaxLifeTime) { + ipF = iparticle->GetFirstDaughter() + fIncFortran; + ipL = iparticle->GetLastDaughter() + fIncFortran; + if (ipF > 0) { + for (j = ipF; j <= ipL; j++) + vFlags[j] = 1; + } else { + vSelected[i] = true; + } + } + } // ks==1 ? + // + // children + + if ((/* ChildSelected(TMath::Abs(kf)) ||*/ fForceDecay != + kNoDecay || + fSelectAll)) { + + if (fCutOnChild) { + pc[0] = iparticle->Px(); + pc[1] = iparticle->Py(); + pc[2] = iparticle->Pz(); + Bool_t childok = KinematicSelection(iparticle, 1); + if (childok) { + vSelected[i] = true; + ncsel++; + } else { + if (!fKeepIfOneChildSelected) { + ncsel = -1; + break; + } + } // child kine cuts + } else { + vSelected[i] = true; + ncsel++; + } // if child selection + } // child selection + } // decay particle loop + } // if decay products + + Int_t iparent; + + if (fKeepParent || (fCutOnChild && ncsel > 0) || !fCutOnChild) { + // + // Parent + // --- For Exodus --------------------------------// + fParticles->Add(new TParticle( + pdg, ((decayed) ? 11 : 1), -1, -1, -1, -1, p[0], p[1], p[2], + energy, origin0[0], origin0[1], origin0[2], time0)); + vParent[0] = nt; + nt++; + fNprimaries++; + + // but count is as "generated" particle" only if it produced child(s) + // within cut + if ((fCutOnChild && ncsel > 0) || !fCutOnChild) { + ipa++; + } + + // + // Decay Products + // + for (i = 1; i < np; i++) { + if (vSelected[i]) { + TParticle *iparticle = (TParticle *)particles->At(i); + auto kf = iparticle->GetPdgCode(); + auto ksc = iparticle->GetStatusCode(); + auto jpa = iparticle->GetFirstMother() + fIncFortran; + + och[0] = origin0[0] + iparticle->Vx(); + och[1] = origin0[1] + iparticle->Vy(); + och[2] = origin0[2] + iparticle->Vz(); + pc[0] = iparticle->Px(); + pc[1] = iparticle->Py(); + pc[2] = iparticle->Pz(); + Double_t ec = iparticle->Energy(); + + if (jpa > -1) { + iparent = vParent[jpa]; + } else { + iparent = -1; + } + auto parentP = (TParticle *)fParticles->At(iparent); + if (parentP->GetFirstDaughter() == -1) + parentP->SetFirstDaughter(nt); + parentP->SetLastDaughter(nt); + fParticles->Add(new TParticle(kf, ksc, iparent, -1, -1, -1, pc[0], + pc[1], pc[2], ec, och0[0], och0[1], + och0[2], time0 + iparticle->T())); + vParent[i] = nt; + nt++; + fNprimaries++; + } // Selected + } // Particle loop + } // Decays by Lujet + particles->Clear(); + vFlags.clear(); + vParent.clear(); + vSelected.clear(); + // kinematic selection + } else { + // nodecay option, so parent will be tracked by GEANT (pions, kaons, + // eta, omegas, baryons) + fParticles->Add(new TParticle(pdg, 1, -1, -1, -1, -1, p[0], p[1], p[2], + energy, origin0[0], origin0[1], + origin0[2], time0)); + ipa++; + fNprimaries++; + } + break; + } // while + } // event loop +} + +int GeneratorParam::ImportParticles(TClonesArray *particles, Option_t *option) { + if (particles == 0) + return 0; + TClonesArray &clonesParticles = *particles; + clonesParticles.Clear(); + Int_t numpart = fParticles->GetEntries(); + for (int i = 0; i < numpart; i++) { + TParticle *particle = (TParticle *)fParticles->At(i); + new (clonesParticles[i]) TParticle(*particle); + } + return numpart; +} + +void GeneratorParam::InitChildSelect() { + // Initialize child selection + fChildSelect.Set(5); + for (Int_t i = 0; i < 5; i++) + fChildSelect[i] = 0; + switch (fForceDecay) { + case kBSemiElectronic: + case kSemiElectronic: + case kDiElectron: + case kBJpsiDiElectron: + case kBPsiPrimeDiElectron: + case kElectronEM: + case kDiElectronEM: + fChildSelect[0] = kElectron; + break; + case kHardMuons: + case kBSemiMuonic: + case kDSemiMuonic: + case kSemiMuonic: + case kDiMuon: + case kJpsiDiMuon: + case kBJpsiDiMuon: + case kBPsiPrimeDiMuon: + case kPiToMu: + case kKaToMu: + case kWToMuon: + case kWToCharmToMuon: + case kZDiMuon: + case kZDiElectron: + fChildSelect[0] = kMuonMinus; + break; + case kHadronicD: + case kHadronicDWithout4Bodies: + case kHadronicDWithV0: + case kHadronicDWithout4BodiesWithV0: + fChildSelect[0] = kPiPlus; + fChildSelect[1] = kKPlus; + break; + case kPhiKK: + fChildSelect[0] = kKPlus; + break; + case kBJpsi: + case kBJpsiUndecayed: + fChildSelect[0] = 443; + break; + case kChiToJpsiGammaToMuonMuon: + fChildSelect[0] = 22; + fChildSelect[1] = 13; + break; + case kChiToJpsiGammaToElectronElectron: + fChildSelect[0] = 22; + fChildSelect[1] = 11; + break; + case kLambda: + fChildSelect[0] = kProton; + fChildSelect[1] = 211; + break; + case kPsiPrimeJpsiDiElectron: + fChildSelect[0] = 211; + fChildSelect[1] = 11; + break; + case kGammaEM: + fChildSelect[0] = kGamma; + break; + case kLcpKpi: + fChildSelect[0] = kProton; + fChildSelect[1] = kKPlus; + fChildSelect[2] = kPiPlus; + break; + case kLcpK0S: + fChildSelect[0] = kProton; + fChildSelect[1] = kK0; + break; + default: + break; + } +} + +Bool_t GeneratorParam::KinematicSelection(const TParticle *particle, + Int_t flag) const { + // Perform kinematic selection + Double_t pz = particle->Pz(); + Double_t pt = particle->Pt(); + Double_t p = particle->P(); + Double_t theta = particle->Theta(); + Double_t mass = particle->GetCalcMass(); + Double_t mt2 = pt * pt + mass * mass; + Double_t phi = particle->Phi(); + Double_t e = particle->Energy(); + + if (e == 0.) + e = TMath::Sqrt(p * p + mass * mass); + + Double_t y, y0; + + if (TMath::Abs(pz) < e) { + y = 0.5 * TMath::Log((e + pz) / (e - pz)); + } else { + y = 1.e10; + } + + if (mt2) { + y0 = 0.5 * TMath::Log((e + TMath::Abs(pz)) * (e + TMath::Abs(pz)) / mt2); + } else { + if (TMath::Abs(y) < 1.e10) { + y0 = y; + } else { + y0 = 1.e10; + } + } + + y = (pz < 0) ? -y0 : y0; + + if (flag == 0) { + // + // Primary particle cuts + // + // transverse momentum cut + if (pt > fPtMax || pt < fPtMin) { + return kFALSE; + } + // + // momentum cut + if (p > fPMax || p < fPMin) { + return kFALSE; + } + // + // theta cut + if (theta > fThetaMax || theta < fThetaMin) { + return kFALSE; + } + // + // rapidity cut + if (y > fYMax || y < fYMin) { + return kFALSE; + } + // + // phi cut + if (phi > fPhiMax || phi < fPhiMin) { + return kFALSE; + } + } else { + // + // Decay product cuts + // + // transverse momentum cut + if (pt > fChildPtMax || pt < fChildPtMin) { + return kFALSE; + } + // + // momentum cut + if (p > fChildPMax || p < fChildPMin) { + return kFALSE; + } + // + // theta cut + if (theta > fChildThetaMax || theta < fChildThetaMin) { + return kFALSE; + } + // + // rapidity cut + if (y > fChildYMax || y < fChildYMin) { + return kFALSE; + } + // + // phi cut + if (phi > fChildPhiMax || phi < fChildPhiMin) { + return kFALSE; + } + } + + return kTRUE; +} + +//_______________________________________________________________________ +void GeneratorParam::SetPtRange(Float_t ptmin, Float_t ptmax) { + // + // Set the Pt range for the generated particles + // + fPtMin = ptmin; + fPtMax = ptmax; + SetBit(kPtRange); +} +//_______________________________________________________________________ +void GeneratorParam::SetMomentumRange(Float_t pmin, Float_t pmax) { + // + // Set the momentum range for the generated particles + // + fPMin = pmin; + fPMax = pmax; + SetBit(kMomentumRange); +} + +//_______________________________________________________________________ +void GeneratorParam::SetPhiRange(Float_t phimin, Float_t phimax) { + // + // Set the Phi range for the generated particles + // + fPhiMin = TMath::Pi() * phimin / 180; + fPhiMax = TMath::Pi() * phimax / 180; + SetBit(kPhiRange); +} + +//_______________________________________________________________________ +void GeneratorParam::SetYRange(Float_t ymin, Float_t ymax) { + // + // Set the Rapidity range for the generated particles + // + fYMin = ymin; + fYMax = ymax; + SetBit(kYRange); +} + +//_______________________________________________________________________ +void GeneratorParam::SetThetaRange(Float_t thetamin, Float_t thetamax) { + // + // Set the theta range for the generated particles + // + fThetaMin = TMath::Pi() * thetamin / 180; + fThetaMax = TMath::Pi() * thetamax / 180; + SetBit(kThetaRange); +} + +//____________________________________________________________________________________ +Float_t GeneratorParam::GetRelativeArea(Float_t ptMin, Float_t ptMax, + Float_t yMin, Float_t yMax, + Float_t phiMin, Float_t phiMax) { + // + // Normalisation for selected kinematic region + // +#if ROOT_VERSION_CODE < ROOT_VERSION(5, 99, 0) + Float_t ratio = fPtPara->Integral(ptMin, ptMax, (Double_t *)0, 1.e-6) / + fPtPara->Integral(fPtPara->GetXmin(), fPtPara->GetXmax(), + (Double_t *)0, 1.e-6) * + fYPara->Integral(yMin, yMax, (Double_t *)0, 1.e-6) / + fYPara->Integral(fYPara->GetXmin(), fYPara->GetXmax(), + (Double_t *)0, 1.e-6) * + (phiMax - phiMin) / 360.; +#else + Float_t ratio = + fPtPara->Integral(ptMin, ptMax, 1.e-6) / + fPtPara->Integral(fPtPara->GetXmin(), fPtPara->GetXmax(), 1.e-6) * + fYPara->Integral(yMin, yMax, 1.e-6) / + fYPara->Integral(fYPara->GetXmin(), fYPara->GetXmax(), 1.e-6) * + (phiMax - phiMin) / 360.; +#endif + return TMath::Abs(ratio); +} + +//____________________________________________________________________________________ + +void GeneratorParam::Draw(const char * /*opt*/) { + // + // Draw the pT and y Distributions + // + TCanvas *c0 = new TCanvas("c0", "Canvas 0", 400, 10, 600, 700); + c0->Divide(2, 1); + c0->cd(1); + fPtPara->Draw(); + fPtPara->GetHistogram()->SetXTitle("p_{T} (GeV)"); + c0->cd(2); + fYPara->Draw(); + fYPara->GetHistogram()->SetXTitle("y"); +} + +//------------------------------------------------------------------- +TVector3 GeneratorParam::OrthogonalVector(TVector3 &inVec) { + double abc[] = {inVec.x(), inVec.y(), inVec.z()}; + double xyz[] = {1, 1, 1}; + int solvDim = 0; + double tmp = abc[0]; + for (int i = 0; i < 3; i++) + if (fabs(abc[i]) > tmp) { + solvDim = i; + tmp = fabs(abc[i]); + } + xyz[solvDim] = (-abc[(1 + solvDim) % 3] - abc[(2 + solvDim) % 3]) / + abc[(0 + solvDim) % 3]; + + TVector3 res(xyz[0], xyz[1], xyz[2]); + return res; +} + +void GeneratorParam::RotateVector(Double_t *pin, Double_t *pout, + Double_t costheta, Double_t sintheta, + Double_t cosphi, Double_t sinphi) { + // Perform rotation + pout[0] = + pin[0] * costheta * cosphi - pin[1] * sinphi + pin[2] * sintheta * cosphi; + pout[1] = + pin[0] * costheta * sinphi + pin[1] * cosphi + pin[2] * sintheta * sinphi; + pout[2] = -1.0 * pin[0] * sintheta + pin[2] * costheta; + return; +} + +double GeneratorParam::ScreenFunction1(double screenVariable) { + if (screenVariable > 1) + return 42.24 - 8.368 * log(screenVariable + 0.952); + else + return 42.392 - screenVariable * (7.796 - 1.961 * screenVariable); +} + +double GeneratorParam::ScreenFunction2(double screenVariable) { + if (screenVariable > 1) + return 42.24 - 8.368 * log(screenVariable + 0.952); + else + return 41.405 - screenVariable * (5.828 - 0.8945 * screenVariable); +} + +double GeneratorParam::RandomEnergyFraction(double Z, double photonEnergy) { + double aZ = Z / 137.036; + double epsilon; + double epsilon0Local = 0.000511 / photonEnergy; + + // Do it fast if photon energy < 2. MeV + if (photonEnergy < 0.002) { + epsilon = epsilon0Local + (0.5 - epsilon0Local) * gRandom->Rndm(); + } else { + double fZ = 8 * log(Z) / 3; + double fcZ = (aZ * aZ) * (1 / (1 + aZ * aZ) + 0.20206 - 0.0368 * aZ * aZ + + 0.0083 * aZ * aZ * aZ); + if (photonEnergy > 0.050) + fZ += 8 * fcZ; + + // Limits of the screening variable + double screenFactor = 136. * epsilon0Local / pow(Z, 1 / 3); + double screenMax = exp((42.24 - fZ) / 8.368) - 0.952; + double screenMin = std::min(4. * screenFactor, screenMax); + + // Limits of the energy sampling + double epsilon1 = 0.5 - 0.5 * sqrt(1. - screenMin / screenMax); + double epsilonMin = std::max(epsilon0Local, epsilon1); + double epsilonRange = 0.5 - epsilonMin; + + // Sample the energy rate of the created electron (or positron) + double screen; + double gReject; + + double f10 = ScreenFunction1(screenMin) - fZ; + double f20 = ScreenFunction2(screenMin) - fZ; + double normF1 = std::max(f10 * epsilonRange * epsilonRange, 0.); + double normF2 = std::max(1.5 * f20, 0.); + + do { + if (normF1 / (normF1 + normF2) > gRandom->Rndm()) { + epsilon = 0.5 - epsilonRange * pow(gRandom->Rndm(), 0.333333); + screen = screenFactor / (epsilon * (1. - epsilon)); + gReject = (ScreenFunction1(screen) - fZ) / f10; + } else { + epsilon = epsilonMin + epsilonRange * gRandom->Rndm(); + screen = screenFactor / (epsilon * (1 - epsilon)); + gReject = (ScreenFunction2(screen) - fZ) / f20; + } + } while (gReject < gRandom->Rndm()); + } // End of epsilon sampling + return epsilon; +} + +double GeneratorParam::RandomPolarAngle() { + double u; + const double a1 = 0.625; + double a2 = 3. * a1; + + if (0.25 > gRandom->Rndm()) { + u = -log(gRandom->Rndm() * gRandom->Rndm()) / a1; + } else { + u = -log(gRandom->Rndm() * gRandom->Rndm()) / a2; + } + return u * 0.000511; +} + +Double_t GeneratorParam::RandomMass(Double_t mh) { + while (true) { + double y = gRandom->Rndm(); + double mee = + 2 * 0.000511 * + TMath::Power(2 * 0.000511 / mh, + -y); // inverse of the enveloping cumulative distribution + double apxkw = 2.0 / 3.0 / 137.036 / TMath::Pi() / + mee; // enveloping probability density + double val = gRandom->Uniform(0, apxkw); + double kw = apxkw * sqrt(1 - 4 * 0.000511 * 0.000511 / mee / mee) * + (1 + 2 * 0.000511 * 0.000511 / mee / mee) * 1 * 1 * + TMath::Power(1 - mee * mee / mh / mh, 3); + if (val < kw) + return mee; + } +} + +Int_t GeneratorParam::VirtualGammaPairProduction(TClonesArray *particles, + Int_t nPart) { + Int_t nPartNew = nPart; + for (int iPart = 0; iPart < nPart; iPart++) { + TParticle *gamma = (TParticle *)particles->At(iPart); + if (gamma->GetPdgCode() != 220001) + continue; + if (gamma->Pt() < 0.002941) + continue; // approximation of kw in AliGenEMlib is 0 below 0.002941 + double mass = RandomMass(gamma->Pt()); + + // lepton pair kinematics in virtual photon rest frame + double Ee = mass / 2; + double Pe = TMath::Sqrt((Ee + 0.000511) * (Ee - 0.000511)); + + double costheta = (2.0 * gRandom->Rndm()) - 1.; + double sintheta = TMath::Sqrt((1. + costheta) * (1. - costheta)); + double phi = 2.0 * TMath::ACos(-1.) * gRandom->Rndm(); + double sinphi = TMath::Sin(phi); + double cosphi = TMath::Cos(phi); + + // momentum vectors of leptons in virtual photon rest frame + Double_t pProd1[3] = {Pe * sintheta * cosphi, Pe * sintheta * sinphi, + Pe * costheta}; + + Double_t pProd2[3] = {-1.0 * Pe * sintheta * cosphi, + -1.0 * Pe * sintheta * sinphi, -1.0 * Pe * costheta}; + + // lepton 4-vectors in properly rotated virtual photon rest frame + Double_t pRot1[3] = {0.}; + RotateVector(pProd1, pRot1, costheta, -sintheta, -cosphi, -sinphi); + Double_t pRot2[3] = {0.}; + RotateVector(pProd2, pRot2, costheta, -sintheta, -cosphi, -sinphi); + + TLorentzVector e1V4(pRot1[0], pRot1[1], pRot1[2], Ee); + TLorentzVector e2V4(pRot2[0], pRot2[1], pRot2[2], Ee); + + TVector3 boost(gamma->Px(), gamma->Py(), gamma->Pz()); + boost *= 1 / sqrt(gamma->P() * gamma->P() + mass * mass); + e1V4.Boost(boost); + e2V4.Boost(boost); + + TLorentzVector vtx; + gamma->ProductionVertex(vtx); + new ((*particles)[nPartNew]) + TParticle(11, gamma->GetStatusCode(), iPart + 1, -1, 0, 0, e1V4, vtx); + nPartNew++; + new ((*particles)[nPartNew]) + TParticle(-11, gamma->GetStatusCode(), iPart + 1, -1, 0, 0, e2V4, vtx); + nPartNew++; + } + return nPartNew; +} + +Int_t GeneratorParam::ForceGammaConversion(TClonesArray *particles, + Int_t nPart) { + // based on: + // http://geant4.cern.ch/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/node27.html + // and: + // http://geant4.cern.ch/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/node58.html + // and: G4LivermoreGammaConversionModel.cc + Int_t nPartNew = nPart; + for (int iPart = 0; iPart < nPart; iPart++) { + TParticle *gamma = (TParticle *)particles->At(iPart); + if (gamma->GetPdgCode() != 22 & gamma->GetPdgCode() != 220000) + continue; + if (gamma->Energy() <= 0.001022) + continue; + TVector3 gammaV3(gamma->Px(), gamma->Py(), gamma->Pz()); + double frac = RandomEnergyFraction(1, gamma->Energy()); + double Ee1 = frac * gamma->Energy(); + double Ee2 = (1 - frac) * gamma->Energy(); + double Pe1 = sqrt((Ee1 + 0.000511) * (Ee1 - 0.000511)); + double Pe2 = sqrt((Ee2 + 0.000511) * (Ee2 - 0.000511)); + + TVector3 rotAxis(OrthogonalVector(gammaV3)); + Float_t az = gRandom->Uniform(TMath::Pi() * 2); + rotAxis.Rotate(az, gammaV3); + TVector3 e1V3(gammaV3); + double u = RandomPolarAngle(); + e1V3.Rotate(u / Ee1, rotAxis); + e1V3 = e1V3.Unit(); + e1V3 *= Pe1; + TVector3 e2V3(gammaV3); + e2V3.Rotate(-u / Ee2, rotAxis); + e2V3 = e2V3.Unit(); + e2V3 *= Pe2; + // gamma = new TParticle(*gamma); + // particles->RemoveAt(iPart); + gamma->SetFirstDaughter(nPartNew + 1); + gamma->SetLastDaughter(nPartNew + 2); + // new((*particles)[iPart]) TParticle(*gamma); + // delete gamma; + + // conversion probability per atom + // fitted G4EMLOW6.35/pair/pp-cs-8.dat, fit is great for E>20MeV + double convProb = 1 / (exp(-log(28.44 * (gamma->Energy() - 0.001022)) * + (0.775 + 0.0271 * log(gamma->Energy() + 1))) + + 1); + + // radiation length is not considered here, so you have to normalize + // yourself in after-production from infinite radiation length to whatever + // you want double meanExessPathlength=0.5*(exp(0.9)-exp(-0.9))/0.9; double + // scale=(1-exp(-7.0/9.0*radLength*meanExessPathlength))/(1-0); + + TLorentzVector vtx; + gamma->ProductionVertex(vtx); + TParticle *currPart; + Int_t sign = (gRandom->Rndm() < 0.5) ? 1 : -1; + currPart = new ((*particles)[nPartNew]) + TParticle(sign * 220011, gamma->GetStatusCode(), iPart + 1, -1, 0, 0, + TLorentzVector(e1V3, Ee1), vtx); + currPart->SetWeight(convProb); + nPartNew++; + currPart = new ((*particles)[nPartNew]) + TParticle(-sign * 220011, gamma->GetStatusCode(), iPart + 1, -1, 0, 0, + TLorentzVector(e2V3, Ee2), vtx); + currPart->SetWeight(convProb); + nPartNew++; + } + return nPartNew; +} diff --git a/GeneratorParam/GeneratorParam.h b/GeneratorParam/GeneratorParam.h new file mode 100644 index 0000000..e9fca4b --- /dev/null +++ b/GeneratorParam/GeneratorParam.h @@ -0,0 +1,217 @@ +#ifndef GENERATORPARAM_H +#define GENERATORPARAM_H +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// Class to generate particles using parametrized pT and y distributions. +// Distributions are obtained from pointer to object of type AliGenLib. +// +// andreas.morsch@cern.ch +// +#include "GeneratorParamLibBase.h" +#include "PythiaDecayerConfig.h" +#include +#include +#include +#include +#include +#include +class TF1; +typedef enum { kNoSmear, kPerEvent, kPerTrack } VertexSmear_t; +typedef enum { kAnalog, kNonAnalog } Weighting_t; + +//------------------------------------------------------------- +class GeneratorParam : public TGenerator { +public: + GeneratorParam(); + GeneratorParam(Int_t npart, const GeneratorParamLibBase *Library, Int_t param, + const char *tname = 0); + GeneratorParam(Int_t npart, Int_t param, const char *tname = 0, + const char *name = 0); + GeneratorParam(Int_t npart, Int_t param, + Double_t (*PtPara)(const Double_t *, const Double_t *), + Double_t (*YPara)(const Double_t *, const Double_t *), + Double_t (*V2Para)(const Double_t *, const Double_t *), + Int_t (*IpPara)(TRandom *)); + GeneratorParam(const char *name, Int_t npart, int pdg, + Double_t (*PtPara)(const Double_t *, const Double_t *) = 0x0, + Double_t (*YPara)(const Double_t *, const Double_t *) = 0x0, + Double_t (*V2Para)(const Double_t *, const Double_t *) = 0x0); + + virtual ~GeneratorParam(); + virtual void GenerateEvent(); + virtual void Init(); + virtual int ImportParticles(TClonesArray *particles, Option_t *option); + // select particle type + virtual void SetParam(Int_t param) { fParam = param; } + // Setting the flag for Background transportation while using SetForceDecay() + void SetSelectAll(Bool_t selectall) { fSelectAll = selectall; } + virtual void SetMomentumRange(Float_t pmin = 0, Float_t pmax = 1.e10); + virtual void SetPtRange(Float_t ptmin = 0, Float_t ptmax = 1.e10); + virtual void SetPhiRange(Float_t phimin = 0., Float_t phimax = 360.); + virtual void SetYRange(Float_t ymin = -100, Float_t ymax = 100); + virtual void SetThetaRange(Float_t thetamin = 0, Float_t thetamax = 180); + virtual void SetNumberParticles(Int_t npart = 100) { fNpart = npart; } + virtual Int_t NumberParticles() const { return fNpart; } + virtual Bool_t KinematicSelection(const TParticle *particle, + Int_t flag) const; + // Kinematic cuts on decay products + virtual void SetForceDecay(Decay_t decay = kAll) { fForceDecay = decay; } + virtual void SetCutOnChild(Int_t flag = 0) { fCutOnChild = flag; } + virtual void SetChildMomentumRange(Float_t pmin = 0, Float_t pmax = 1.e10) { + fChildPMin = pmin; + fChildPMax = pmax; + } + virtual void SetChildPtRange(Float_t ptmin = 0, Float_t ptmax = 20.) { + fChildPtMin = ptmin; + fChildPtMax = ptmax; + } + virtual void SetChildPhiRange(Float_t phimin = 0., Float_t phimax = 360.) { + fChildPhiMin = TMath::Pi() * phimin / 180; + fChildPhiMax = TMath::Pi() * phimax / 180; + } + virtual void SetChildThetaRange(Float_t thetamin = 0, + Float_t thetamax = 180) { + fChildThetaMin = TMath::Pi() * thetamin / 180; + fChildThetaMax = TMath::Pi() * thetamax / 180; + } + virtual void SetChildYRange(Float_t ymin = -12, Float_t ymax = 12) { + fChildYMin = ymin; + fChildYMax = ymax; + } + virtual void SetMaximumLifetime(Float_t time = 1.e-15) { + fMaxLifeTime = time; + } + // force decay type + virtual void SetDeltaPt(Float_t delta = 0.01) { fDeltaPt = delta; } + virtual void SetDecayer(TVirtualMCDecayer *decayer) { fDecayer = decayer; } + virtual void SetForceGammaConversion(Bool_t force = kTRUE) { + fForceConv = force; + } + virtual void SetKeepParent(Bool_t keep = kTRUE) { + fKeepParent = keep; + } // Store parent even if it does not have childs within cuts + virtual void SetKeepIfOneChildSelected(Bool_t keep = kTRUE) { + fKeepIfOneChildSelected = keep; + } // Accept parent and child even if other children are not within cut. + virtual void SetPreserveFullDecayChain(Int_t preserve = kFALSE) { + fPreserveFullDecayChain = preserve; + } // Prevent flagging(/skipping) of decay daughter particles; preserves + // complete forced decay chain + + virtual void Draw(const char *opt); + TF1 *GetPt() { return fPtPara; } + TF1 *GetY() { return fYPara; } + Float_t GetRelativeArea(Float_t ptMin, Float_t ptMax, Float_t yMin, + Float_t yMax, Float_t phiMin, Float_t phiMax); + + static TVector3 OrthogonalVector(TVector3 &inVec); + static void RotateVector(Double_t *pin, Double_t *pout, Double_t costheta, + Double_t sintheta, Double_t cosphi, Double_t sinphi); + static double ScreenFunction1(double d); + static double ScreenFunction2(double d); + double RandomEnergyFraction(double Z, double E); + double RandomPolarAngle(); + double RandomMass(Double_t mh); + Int_t VirtualGammaPairProduction(TClonesArray *particles, Int_t nPart); + Int_t ForceGammaConversion(TClonesArray *particles, Int_t nPart); + virtual void SetSeed(UInt_t /*seed*/) { ; } + + // allow explicit setting of functions in case of streaming + void SetParamsExplicitly(const GeneratorParamLibBase *Library, Int_t param, + const char *tname) { + fPtParaFunc = Library->GetPt(param, tname); + fYParaFunc = Library->GetY(param, tname); + fIpParaFunc = Library->GetIp(param, tname); + fV2ParaFunc = Library->GetV2(param, tname); + } + + // retrive particle type + Int_t GetParam() { return fParam; } + +protected: + Double_t (*fPtParaFunc)( + const Double_t *, + const Double_t *); //! Pointer to Pt parametrisation function + Double_t (*fYParaFunc)( + const Double_t *, + const Double_t *); //! Pointer to Y parametrisation function + Int_t (*fIpParaFunc)( + TRandom *); //! Pointer to particle type parametrisation function + Double_t (*fV2ParaFunc)( + const Double_t *, + const Double_t *); //! Pointer to V2 parametrisation function + TF1 *fPtPara = 0; // Transverse momentum parameterisation + TF1 *fYPara = 0; // Rapidity parameterisation + TF1 *fV2Para = 0; // v2 parametrization + TF1 *fdNdPhi = 0; // Phi distribution depending on v2 + Int_t fParam = 0; // Parameterisation type + Float_t fDeltaPt = 0.01; // pT sampling in steps of fDeltaPt + Bool_t fSelectAll = false; // Flag for transportation of Background while + // using SetForceDecay() + TVirtualMCDecayer *fDecayer = 0; // ! Pointer to virtual decyer + Bool_t fForceConv = false; // force converson of gammas + Bool_t fKeepParent = + false; // Store parent even if it does not have childs within cuts + Bool_t fKeepIfOneChildSelected = true; // Accept parent and child even if + // other children are not within cut. + Bool_t fPreserveFullDecayChain = + true; // Prevent flagging(/skipping) of decay daughter particles; + // preserves complete forced decay chain + Int_t fPDGcode = -1; // PDG code in case of single particle injector + Int_t fIncFortran = -1; // respect fortran counting in particle list (Pythia6) + // kinematic cuts + Float_t fPtMin = 0.; + Float_t fPtMax = 0.; + Float_t fPMin = 0.; + Float_t fPMax = 1.e10; + Float_t fPhiMin = 0.; + Float_t fPhiMax = 2. * TMath::Pi(); + Float_t fYMin = 0.; + Float_t fYMax = 0.; + Float_t fThetaMin = 0.; + Float_t fThetaMax = TMath::Pi(); + Float_t fMaxLifeTime = 0.; + Int_t fNpart = 0; + Float_t fTimeOrigin = 0.; + Float_t fTime = 0.; + Float_t fEvPlane = 0.; + Decay_t fForceDecay = kAll; + Int_t fNprimaries = 0; + Bool_t fCutOnChild = 0.; + Float_t fChildPMin = 0.; + Float_t fChildPMax = 0.; + Float_t fChildPtMin = 0.; + Float_t fChildPtMax = 0.; + Float_t fChildYMin = 0.; + Float_t fChildYMax = 0.; + Float_t fChildThetaMin = 0.; + Float_t fChildThetaMax = 0.; + Float_t fChildPhiMin = 0.; + Float_t fChildPhiMax = 0.; + TArrayI fChildSelect; //! Decay products to be selected + enum { + kThetaRange = BIT(14), + kPhiRange = BIT(16), + kPtRange = BIT(17), + kYRange = BIT(18), + kMomentumRange = BIT(19), + kEtaRange = BIT(20) + }; + +private: + void InitChildSelect(); + GeneratorParam(const GeneratorParam &Param); + GeneratorParam &operator=(const GeneratorParam &rhs); + + ClassDef(GeneratorParam, + 1) // Generator using parameterised pt- and y-distribution +}; +#endif diff --git a/GeneratorParam/GeneratorParamLibBase.cxx b/GeneratorParam/GeneratorParamLibBase.cxx new file mode 100644 index 0000000..3a85636 --- /dev/null +++ b/GeneratorParam/GeneratorParamLibBase.cxx @@ -0,0 +1,16 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// +// Realisation of GenerarorParamLibBase for muon studies +// +#include "GeneratorParamLibBase.h" + +ClassImp(GeneratorParamLibBase) diff --git a/GeneratorParam/GeneratorParamLibBase.h b/GeneratorParam/GeneratorParamLibBase.h new file mode 100644 index 0000000..afa8819 --- /dev/null +++ b/GeneratorParam/GeneratorParamLibBase.h @@ -0,0 +1,36 @@ +#ifndef GENERATORPARAMLIBBASE_H +#define GENERATORPARAMLIBBASE_H +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +// Baae class for parameterisations used by GeneratorParam +// andreas.morsch@cern.ch + +#include + +class TRandom; + +class GeneratorParamLibBase : public TObject { +public: + // + virtual ~GeneratorParamLibBase() {} + typedef Double_t (*GenFunc)(const Double_t *, const Double_t *); + typedef Int_t (*GenFuncIp)(TRandom *); + virtual GenFunc GetPt(Int_t param, const char *tname) const = 0; + virtual GenFunc GetY(Int_t param, const char *tname) const = 0; + virtual GenFuncIp GetIp(Int_t param, const char *tname) const = 0; + virtual GenFunc GetV2(Int_t, const char *) const { return NoV2; } + static Double_t NoV2(const Double_t *, const Double_t *) { return 0; } + ClassDef(GeneratorParamLibBase, + 0) // Library providing y and pT parameterisations +}; +#endif diff --git a/GeneratorParam/GeneratorParamLinkDef.h b/GeneratorParam/GeneratorParamLinkDef.h new file mode 100644 index 0000000..2f15141 --- /dev/null +++ b/GeneratorParam/GeneratorParamLinkDef.h @@ -0,0 +1,12 @@ +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class GeneratorParam+; +#pragma link C++ class GeneratorParamLibBase+; +#pragma link C++ class GeneratorParamMUONlib+; +#pragma link C++ class PythiaDecayerConfig+; + +#endif diff --git a/GeneratorParam/GeneratorParamMUONlib.cxx b/GeneratorParam/GeneratorParamMUONlib.cxx new file mode 100644 index 0000000..f78f9ea --- /dev/null +++ b/GeneratorParam/GeneratorParamMUONlib.cxx @@ -0,0 +1,4981 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// +// Realisation of GenerarorParamLibBase for muon studies +// +#include "TDatabasePDG.h" +#include "TMath.h" +#include "TRandom.h" + +#include "GeneratorParamMUONlib.h" + +ClassImp(GeneratorParamMUONlib) + // + // Pions + Double_t GeneratorParamMUONlib::PtPion(const Double_t *px, + const Double_t * /*dummy*/) { + // + // PT-PARAMETERIZATION CDF, PRL 61(88) 1819 + // POWER LAW FOR PT > 500 MEV + // MT SCALING BELOW (T=160 MEV) + // + const Double_t kp0 = 1.3; + const Double_t kxn = 8.28; + const Double_t kxlim = 0.5; + const Double_t kt = 0.160; + const Double_t kxmpi = 0.139; + const Double_t kb = 1.; + Double_t y, y1, xmpi2, ynorm, a; + Double_t x = *px; + // + y1 = TMath::Power(kp0 / (kp0 + kxlim), kxn); + xmpi2 = kxmpi * kxmpi; + ynorm = kb * (TMath::Exp(-sqrt(kxlim * kxlim + xmpi2) / kt)); + a = ynorm / y1; + if (x > kxlim) + y = a * TMath::Power(kp0 / (kp0 + x), kxn); + else + y = kb * TMath::Exp(-sqrt(x * x + xmpi2) / kt); + return y * x; +} +// +// y-distribution +// +Double_t GeneratorParamMUONlib::YPion(const Double_t *py, + const Double_t * /*dummy*/) { + // Pion y + Double_t y = TMath::Abs(*py); + /* + const Double_t ka = 7000.; + const Double_t kdy = 4.; + Double_t ex = y*y/(2*kdy*kdy); + return ka*TMath::Exp(-ex); + */ + return 1.16526e+04 + y * -3.79886e+03 + y * y * 4.31130e+02; +} +// particle composition +// +Int_t GeneratorParamMUONlib::IpPion(TRandom *ran) { + // Pion composition + if (ran->Rndm() < 0.5) { + return 211; + } else { + return -211; + } +} + +//____________________________________________________________ +// +// Mt-scaling + +Double_t GeneratorParamMUONlib::PtScal(Double_t pt, Int_t np) { + // SCALING EN MASSE PAR RAPPORT A PTPI + // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI + const Double_t khm[10] = {.13957, .493, .5488, .769, .7826, + .958, 1.02, 0, 0, 0}; + // VALUE MESON/PI AT 5 GEV + const Double_t kfmax[10] = {1., 0.3, 0.55, 1.0, 1.0, 1.0, 1.0, 0, 0, 0}; + np--; + Double_t f5 = TMath::Power( + ((sqrt(100.018215) + 2.) / (sqrt(100. + khm[np] * khm[np]) + 2.0)), 12.3); + Double_t fmax2 = f5 / kfmax[np]; + // PIONS + Double_t ptpion = 100. * PtPion(&pt, (Double_t *)0); + Double_t fmtscal = TMath::Power(((sqrt(pt * pt + 0.018215) + 2.) / + (sqrt(pt * pt + khm[np] * khm[np]) + 2.0)), + 12.3) / + fmax2; + return fmtscal * ptpion; +} +// +// kaon +// +// pt-distribution +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtKaon(const Double_t *px, + const Double_t * /*dummy*/) { + // Kaon pT + return PtScal(*px, 2); +} + +// y-distribution +//____________________________________________________________ +Double_t GeneratorParamMUONlib::YKaon(const Double_t *py, + const Double_t * /*dummy*/) { + // Kaon y + Double_t y = TMath::Abs(*py); + /* + const Double_t ka = 1000.; + const Double_t kdy = 4.; + // + Double_t ex = y*y/(2*kdy*kdy); + return ka*TMath::Exp(-ex); + */ + + return 1.16526e+04 + y * -3.79886e+03 + y * y * 4.31130e+02; +} + +// particle composition +// +Int_t GeneratorParamMUONlib::IpKaon(TRandom *ran) { + // Kaon composition + if (ran->Rndm() < 0.5) { + return 321; + } else { + return -321; + } +} + +// J/Psi +// +// +// pt-distribution +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtJpsiPPdummy(Double_t x, Double_t energy) { + // J/Psi pT + // pp + // from the fit of RHIC, CDF & LHC data, see arXiv:1103.2394 + // + const Double_t kpt0 = 1.04 * TMath::Power(energy, 0.101); + const Double_t kxn = 3.9; + // + Double_t pass1 = 1. + 0.363 * (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtJpsiPP7000(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // pp 7 TeV + // + return PtJpsiPPdummy(*px, 7000); +} + +Double_t GeneratorParamMUONlib::PtJpsiPP8000(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // pp 7 TeV + // + return PtJpsiPPdummy(*px, 8000); +} + +Double_t GeneratorParamMUONlib::PtJpsiPP2760(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // pp 2.76 TeV + // + return PtJpsiPPdummy(*px, 2760); +} + +Double_t GeneratorParamMUONlib::PtJpsiPP4400(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // pp 4.4 TeV + // + return PtJpsiPPdummy(*px, 4400); +} + +Double_t GeneratorParamMUONlib::PtJpsiPP5030(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // pp 5.03 TeV + // + return PtJpsiPPdummy(*px, 5030); +} + +Double_t GeneratorParamMUONlib::PtJpsiPP8800(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // pp 8.8 TeV + // + return PtJpsiPPdummy(*px, 8800); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760ShFdummy(Double_t x, Int_t n) { + // J/Psi shadowing factor vs pT for PbPb min. bias and 11 centr. bins + // (in 2.5 0) { + y1 = y1 * x + c1[--j]; + y2 = y2 * x + c2[j]; + } + + y1 /= 1. + c1[6] * TMath::Power(x, 6); + y2 /= 1. + c2[6] * TMath::Power(x, 6); + // + y1 = 1 + (y1 - 2) * f1[n] + (y2 + 1 - y1) * f2[n]; + if (y1 < 0) + y1 = 0; + return y1; +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, minimum bias 0-100 % + // + return PtJpsiPbPb2760ShFdummy(*px, 0) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c1(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 1st centrality bin 0-5 % + // + return PtJpsiPbPb2760ShFdummy(*px, 1) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c2(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 2nd centrality bin 5-10 % + // + return PtJpsiPbPb2760ShFdummy(*px, 2) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c3(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 3rd centrality bin 10-20 % + // + return PtJpsiPbPb2760ShFdummy(*px, 3) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c4(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 4th centrality bin 20-30 % + // + return PtJpsiPbPb2760ShFdummy(*px, 4) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c5(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 5th centrality bin 30-40 % + // + return PtJpsiPbPb2760ShFdummy(*px, 5) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c6(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 6th centrality bin 40-50 % + // + return PtJpsiPbPb2760ShFdummy(*px, 6) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c7(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 7th centrality bin 50-60 % + // + return PtJpsiPbPb2760ShFdummy(*px, 7) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c8(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 8th centrality bin 60-70 % + // + return PtJpsiPbPb2760ShFdummy(*px, 8) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c9(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 9th centrality bin 70-80 % + // + return PtJpsiPbPb2760ShFdummy(*px, 9) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c10(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 10th centrality bin 80-90 % + // + return PtJpsiPbPb2760ShFdummy(*px, 10) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb2760c11(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // PbPb 2.76 TeV, 11th centrality bin 90-100 % + // + return PtJpsiPbPb2760ShFdummy(*px, 11) * PtJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb5030ShFdummy(Double_t x, Int_t n) { + // J/Psi shadowing factor vs pT for pPb min. bias and 4 centr. bins + // (in 2.5 0) + y = y * x + c[--j]; + y /= 1 + c[6] * TMath::Power(x, 6); + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb5030(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 5.03 TeV, minimum bias 0-100 % + // + return PtJpsiPPb5030ShFdummy(*px, 0) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb5030c1(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 5.03 TeV, 1st centrality bin 0-20 % + // + return PtJpsiPPb5030ShFdummy(*px, 1) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb5030c2(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 5.03 TeV, 2nd centrality bin 20-40 % + // + return PtJpsiPPb5030ShFdummy(*px, 2) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb5030c3(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 5.03 TeV, 3rd centrality bin 40-60 % + // + return PtJpsiPPb5030ShFdummy(*px, 3) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb5030c4(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 5.03 TeV, 4th centrality bin 60-100 % + // + return PtJpsiPPb5030ShFdummy(*px, 4) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP5030ShFdummy(Double_t x, Int_t n) { + // J/Psi shadowing factor vs pT for Pbp min. bias and 4 centr. bins + // (in 2.5 0) + y = y * x + c[--j]; + y /= 1 + c[6] * TMath::Power(x, 6); + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP5030(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 5.03 TeV, minimum bias 0-100 % + // + return PtJpsiPbP5030ShFdummy(*px, 0) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP5030c1(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 5.03 TeV, 1st centrality bin 0-20 % + // + return PtJpsiPbP5030ShFdummy(*px, 1) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP5030c2(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 5.03 TeV, 2nd centrality bin 20-40 % + // + return PtJpsiPbP5030ShFdummy(*px, 2) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP5030c3(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 5.03 TeV, 3rd centrality bin 40-60 % + // + return PtJpsiPbP5030ShFdummy(*px, 3) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP5030c4(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 5.03 TeV, 4th centrality bin 60-100 % + // + return PtJpsiPbP5030ShFdummy(*px, 4) * PtJpsiPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb8800ShFdummy(Double_t x, Int_t n) { + // J/Psi shadowing factor vs pT for pPb min. bias and 4 centr. bins + // (in 2.5 0) + y = y * x + c[--j]; + y /= 1 + c[6] * TMath::Power(x, 6); + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb8800(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 8.8 TeV, minimum bias 0-100 % + // + return PtJpsiPPb8800ShFdummy(*px, 0) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb8800c1(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 8.8 TeV, 1st centrality bin 0-20 % + // + return PtJpsiPPb8800ShFdummy(*px, 1) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb8800c2(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 8.8 TeV, 2nd centrality bin 20-40 % + // + return PtJpsiPPb8800ShFdummy(*px, 2) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb8800c3(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 8.8 TeV, 3rd centrality bin 40-60 % + // + return PtJpsiPPb8800ShFdummy(*px, 3) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPPb8800c4(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // pPb 8.8 TeV, 4th centrality bin 60-100 % + // + return PtJpsiPPb8800ShFdummy(*px, 4) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP8800ShFdummy(Double_t x, Int_t n) { + // J/Psi shadowing factor vs pT for Pbp min. bias and 4 centr. bins + // (in 2.5 0) + y = y * x + c[--j]; + y /= 1 + c[6] * TMath::Power(x, 6); + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP8800(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 8.8 TeV, minimum bias 0-100 % + // + return PtJpsiPbP8800ShFdummy(*px, 0) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP8800c1(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 8.8 TeV, 1st centrality bin 0-20 % + // + return PtJpsiPbP8800ShFdummy(*px, 1) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP8800c2(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 8.8 TeV, 2nd centrality bin 20-40 % + // + return PtJpsiPbP8800ShFdummy(*px, 2) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP8800c3(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 8.8 TeV, 3rd centrality bin 40-60 % + // + return PtJpsiPbP8800ShFdummy(*px, 3) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiPbP8800c4(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // Pbp 8.8 TeV, 4th centrality bin 60-100 % + // + return PtJpsiPbP8800ShFdummy(*px, 4) * PtJpsiPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsi(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + const Double_t kpt0 = 4.; + const Double_t kxn = 3.6; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaled(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // + // PbPb 5.5 TeV + // scaled from CDF data at 2 TeV + // see S.Grigoryan, PWG3 Meeting, 27th Oct 2008 + + const Double_t kpt0 = 5.100; + const Double_t kxn = 4.102; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaledPP(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // + // pp 14 TeV + // scaled from CDF data at 2 TeV + + const Double_t kpt0 = 5.630; + const Double_t kxn = 4.071; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t +GeneratorParamMUONlib::PtJpsiCDFscaledPP10(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // + // pp 10 TeV + // scaled from CDF data at 2 TeV + + const Double_t kpt0 = 5.334; + const Double_t kxn = 4.071; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaledPP9(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // + // pp 8.8 TeV + // scaled from CDF data at 2 TeV + // + const Double_t kpt0 = 5.245; + const Double_t kxn = 4.071; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaledPP7(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // + // pp 7 TeV + // scaled from CDF data at 2 TeV + + const Double_t kpt0 = 5.072; + const Double_t kxn = 4.071; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaledPP4(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // + // pp 3.94 TeV + // scaled from CDF data at 2 TeV + // + const Double_t kpt0 = 4.647; + const Double_t kxn = 4.071; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaledPP3(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // + // pp 2.76 TeV + // scaled from CDF data at 1.9 TeV + // + const Double_t kpt0 = 4.435; + const Double_t kxn = 4.071; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaledPP2(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT + // + // pp 1.96 TeV + // fit of the CDF data at 1.96 TeV + // + const Double_t kpt0 = 4.233; + const Double_t kxn = 4.071; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaledPPb9(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // + // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.79 + // + Double_t c[5] = {6.42774e-01, 1.86168e-02, -6.77296e-04, 8.93512e-06, + 1.31586e-07}; + Double_t x = *px; + Double_t y; + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + // + Double_t d = 1. + c[4] * TMath::Power(x, 4); + return y / d * GeneratorParamMUONlib::PtJpsiCDFscaledPP9(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaledPbP9(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // + // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.79 + // + Double_t c[5] = {8.58557e-01, 5.39791e-02, -4.75180e-03, 2.49463e-04, + 5.52396e-05}; + Double_t x = *px; + Double_t y; + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + // + Double_t d = 1. + c[4] * TMath::Power(x, 4); + return y / d * GeneratorParamMUONlib::PtJpsiCDFscaledPP9(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiCDFscaledPbPb4(const Double_t *px, + const Double_t *dummy) { + // J/Psi pT + // + // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.66 + // + Double_t c[5] = {6.01022e-01, 4.70988e-02, -2.27917e-03, 3.09885e-05, + 1.31955e-06}; + Double_t x = *px; + Double_t y; + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + // + Double_t d = 1. + c[4] * TMath::Power(x, 4); + return y / d * GeneratorParamMUONlib::PtJpsiCDFscaledPP4(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtJpsiFlat(const Double_t * /*px*/, + const Double_t * /*dummy*/) { + return 1.; +} + +Double_t GeneratorParamMUONlib::PtJpsiPbPb(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT spectrum + // + // R. Vogt 2002 + // PbPb 5.5 TeV + // MRST HO + // mc = 1.4 GeV, pt-kick 1 GeV + // + Float_t x = px[0]; + Float_t c[8] = {-2.13098e+00, 9.46552e+00, -5.06799e+00, 1.27260e+00, + -1.83806e-01, 1.55853e-02, -7.23241e-04, 1.42105e-05}; + + Double_t y; + if (x < 10.) { + Int_t j; + y = c[j = 7]; + while (j > 0) + y = y * x + c[--j]; + y = x * TMath::Exp(y); + } else { + y = 0.; + } + return y; +} + +Double_t GeneratorParamMUONlib::PtJpsiBPbPb(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT spectrum + // B -> J/Psi X + Double_t x0 = 4.0384; + Double_t n = 3.0288; + + Double_t x = px[0]; + Double_t y = x / TMath::Power((1. + (x / x0) * (x / x0)), n); + + return y; +} + +Double_t GeneratorParamMUONlib::PtJpsiPP(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi pT spectrum + // + // R. Vogt 2002 + // pp 14 TeV + // MRST HO + // mc = 1.4 GeV, pt-kick 1 GeV + // + Float_t x = px[0]; + Float_t c[4] = {8.47471e+00, -1.93567e+00, 1.50271e-01, -5.51212e-03}; + + Double_t y; + if (x < 10.) { + Int_t j; + y = c[j = 3]; + while (j > 0) + y = y * x + c[--j]; + y = x * TMath::Exp(y); + } else { + y = 0.; + } + return y; +} + +// +// y-distribution +//____________________________________________________________ +Double_t GeneratorParamMUONlib::YJpsiPPdummy(Double_t x, Double_t energy) { + // J/Psi y + // pp + // from the fit of RHIC + LHC data, see arXiv:1103.2394 + // + x = x / TMath::Log(energy / 3.097); + x = x * x; + Double_t y = TMath::Exp(-x / 0.4 / 0.4 / 2); + if (x > 1) + y = 0; + return y; +} + +Double_t GeneratorParamMUONlib::YJpsiPPpoly(Double_t x, Double_t energy) { + // J/Psi y + // pp + // from the fit of RHIC + LHC data, see arXiv:1103.2394 + // + x = x / TMath::Log(energy / 3.097); + x = x * x; + Double_t y = 1 - 6.9 * x * x; + if (y < 0) + y = 0; + return y; +} + +Double_t GeneratorParamMUONlib::YJpsiPP7000(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pp 7 TeV + // + return YJpsiPPdummy(*px, 7000); +} + +Double_t GeneratorParamMUONlib::YJpsiPP8000(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pp 7 TeV + // + return YJpsiPPdummy(*px, 8000); +} + +Double_t GeneratorParamMUONlib::YJpsiPP2760(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pp 2.76 TeV + // + return YJpsiPPdummy(*px, 2760); +} + +Double_t GeneratorParamMUONlib::YJpsiPP4400(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pp 4.4 TeV + // + return YJpsiPPdummy(*px, 4400); +} + +Double_t GeneratorParamMUONlib::YJpsiPP5030(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pp 5.03 TeV + // + return YJpsiPPdummy(*px, 5030); +} + +Double_t GeneratorParamMUONlib::YJpsiPP8800(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pp 8.8 TeV + // + return YJpsiPPdummy(*px, 8800); +} + +Double_t GeneratorParamMUONlib::YJpsiPPpoly7000(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pp 7 TeV + // + return YJpsiPPpoly(*px, 7000); +} + +Double_t GeneratorParamMUONlib::YJpsiPPpoly2760(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pp 2.76 TeV + // + return YJpsiPPpoly(*px, 2760); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760ShFdummy(Double_t x, Int_t n) { + // J/Psi shadowing factor vs y for PbPb min. bias and 11 centr. bins + // + // PbPb 2.76 TeV, for EKS98, minimum bias shadowing factor = 0.66 in 4pi + // + const Double_t f1[12] = {1, 1.128, 1.097, 1.037, 0.937, 0.821, + 0.693, 0.558, 0.428, 0.317, 0.231, 0.156}; + const Double_t f2[12] = {1, 1.313, 1.202, 1.039, 0.814, 0.593, + 0.391, 0.224, 0.106, 0.041, 0.013, 0.002}; + const Double_t c1[5] = {1.5591e+00, 7.5827e-03, 2.0676e-03, -1.1717e-04, + 1.5237e-06}; + const Double_t c2[5] = {6.0861e-01, 4.8854e-03, 1.3685e-03, -7.9182e-05, + 1.0475e-06}; + + x = x * x; + Double_t y1, y2; + Int_t j; + y1 = c1[j = 4]; + y2 = c2[4]; + while (j > 0) { + y1 = y1 * x + c1[--j]; + y2 = y2 * x + c2[j]; + } + + y1 = 1 + (y1 - 2) * f1[n] + (y2 + 1 - y1) * f2[n]; + if (y1 < 0) + y1 = 0; + return y1; +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, minimum bias 0-100 % + // + return YJpsiPbPb2760ShFdummy(*px, 0) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c1(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 1st centrality bin 0-5 % + // + return YJpsiPbPb2760ShFdummy(*px, 1) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c2(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 2nd centrality bin 5-10 % + // + return YJpsiPbPb2760ShFdummy(*px, 2) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c3(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 3rd centrality bin 10-20 % + // + return YJpsiPbPb2760ShFdummy(*px, 3) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c4(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 4th centrality bin 20-30 % + // + return YJpsiPbPb2760ShFdummy(*px, 4) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c5(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 5th centrality bin 30-40 % + // + return YJpsiPbPb2760ShFdummy(*px, 5) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c6(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 6th centrality bin 40-50 % + // + return YJpsiPbPb2760ShFdummy(*px, 6) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c7(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 7th centrality bin 50-60 % + // + return YJpsiPbPb2760ShFdummy(*px, 7) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c8(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 8th centrality bin 60-70 % + // + return YJpsiPbPb2760ShFdummy(*px, 8) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c9(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 9th centrality bin 70-80 % + // + return YJpsiPbPb2760ShFdummy(*px, 9) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c10(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 10th centrality bin 80-90 % + // + return YJpsiPbPb2760ShFdummy(*px, 10) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb2760c11(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // PbPb 2.76 TeV, 11th centrality bin 90-100 % + // + return YJpsiPbPb2760ShFdummy(*px, 11) * YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiPP5030dummy(Double_t px) { + return GeneratorParamMUONlib::YJpsiPP5030(&px, (Double_t *)0); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb5030ShFdummy(Double_t x, Int_t n) { + // J/Psi shadowing factor vs y for pPb min. bias and 4 centr. bins + // + // pPb 5.03 TeV, for EPS09-LO, minimum bias shadowing factor = 0.81 in 4pi + // + const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23}; + const Double_t c[7] = {7.641e-01, 1.611e-02, 4.109e-03, 2.818e-03, + 3.359e-04, -6.376e-05, -9.717e-06}; + Double_t y; + Int_t j; + y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::YJpsiPPb5030(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 5.03 TeV, minimum bias 0-100 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 0) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb5030c1(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 5.03 TeV, 1st centrality bin 0-20 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 1) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb5030c2(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 5.03 TeV, 2nd centrality bin 20-40 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 2) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb5030c3(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 5.03 TeV, 3rd centrality bin 40-60 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 3) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb5030c4(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 5.03 TeV, 4th centrality bin 60-100 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 4) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP5030(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 5.03 TeV, minimum bias 0-100 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 0) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP5030c1(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 5.03 TeV, 1st centrality bin 0-20 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 1) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP5030c2(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 5.03 TeV, 2nd centrality bin 20-40 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 2) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP5030c3(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 5.03 TeV, 3rd centrality bin 40-60 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 3) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP5030c4(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 5.03 TeV, 4th centrality bin 60-100 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb5030ShFdummy(x, 4) * YJpsiPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPP8800dummy(Double_t px) { + return GeneratorParamMUONlib::YJpsiPP8800(&px, (Double_t *)0); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb8800ShFdummy(Double_t x, Int_t n) { + // J/Psi shadowing factor vs y for pPb min. bias and 4 centr. bins + // + // pPb 8.8 TeV, for EKS98, minimum bias shadowing factor = 0.78 in 4pi + // + const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23}; + const Double_t c[7] = {7.4372e-01, 2.3299e-02, 2.8678e-03, 1.9595e-03, + 3.2849e-04, -4.0547e-05, -7.9732e-06}; + Double_t y; + Int_t j; + y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::YJpsiPPb8800(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 8.8 TeV, minimum bias 0-100 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 0) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb8800c1(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 8.8 TeV, 1st centrality bin 0-20 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 1) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb8800c2(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 8.8 TeV, 2nd centrality bin 20-40 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 2) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb8800c3(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 8.8 TeV, 3rd centrality bin 40-60 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 3) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPPb8800c4(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pPb 8.8 TeV, 4th centrality bin 60-100 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 4) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP8800(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 8.8 TeV, minimum bias 0-100 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 0) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP8800c1(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 8.8 TeV, 1st centrality bin 0-20 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 1) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP8800c2(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 8.8 TeV, 2nd centrality bin 20-40 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 2) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP8800c3(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 8.8 TeV, 3rd centrality bin 40-60 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 3) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiPbP8800c4(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // Pbp 8.8 TeV, 4th centrality bin 60-100 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YJpsiPPb8800ShFdummy(x, 4) * YJpsiPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsi(const Double_t *py, + const Double_t * /*dummy*/) { + // J/psi y + const Double_t ky0 = 4.; + const Double_t kb = 1.; + Double_t yj; + Double_t y = TMath::Abs(*py); + // + if (y < ky0) + yj = kb; + else + yj = kb * TMath::Exp(-(y - ky0) * (y - ky0) / 2); + return yj; +} + +Double_t GeneratorParamMUONlib::YJpsiFlat(const Double_t * /*py*/, + const Double_t * /*dummy*/) { + return 1.; +} + +Double_t GeneratorParamMUONlib::YJpsiPbPb(const Double_t *px, + const Double_t * /*dummy*/) { + + // + // J/Psi y + // + // + // R. Vogt 2002 + // PbPb 5.5 TeV + // MRST HO + // mc = 1.4 GeV, pt-kick 1 GeV + // + Double_t c[5] = {-6.03425e+02, 4.98257e+02, -1.38794e+02, 1.62209e+01, + -6.85955e-01}; + Double_t x = TMath::Abs(px[0]); + Double_t y; + + if (x < 4.) { + y = 31.754; + } else if (x < 6) { + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + } else { + y = 0.; + } + + return y; +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaled(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + return GeneratorParamMUONlib::YJpsiPbPb(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPP(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + return GeneratorParamMUONlib::YJpsiPP(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPP10(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // + // pp 10 TeV + // scaled from YJpsiPP(14 TeV) using 10 TeV / 14 TeV ratio of y-spectra in LO + // pQCD. see S.Grigoryan, PWG3 Meeting, 27th Oct 2008 + // + + Double_t c[5] = {2.46681e+01, 8.91486e+01, -3.21227e+01, 3.63075e+00, + -1.32047e-01}; + + Double_t x = TMath::Abs(px[0]); + Double_t y; + + if (x < 3.2) { + y = 98.523 - 1.3664 * x * x; + } else if (x < 7.5) { + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + } else { + y = 0.; + } + + if (y < 0) + y = 0; + + return y; +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPP9(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // + // pp 8.8 TeV + // rescaling of YJpsiPP(14 TeV) using 8.8 TeV / 14 TeV ratio of y-spectra in + // LO QCD + // + Double_t c[5] = {3.33882e+02, -1.30980e+02, 2.59082e+01, -3.08935e+00, + 1.56375e-01}; + Double_t x = TMath::Abs(px[0]); + Double_t y; + + if (x < 3.7) { + y = 99.236 - 1.5498 * x * x; + } else if (x < 7.4) { + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + } else { + y = 0.; + } + + if (y < 0) + y = 0; + + return y; +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPP9dummy(Double_t px) { + return GeneratorParamMUONlib::YJpsiCDFscaledPP9(&px, (Double_t *)0); +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPP7(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // + // pp 7 TeV + // scaled from YJpsiPP(14 TeV) using 7 TeV / 14 TeV ratio of y-spectra in LO + // pQCD. + // + + Double_t c[5] = {6.71181e+02, -3.69240e+02, 8.89644e+01, -1.04937e+01, + 4.80959e-01}; + + Double_t x = TMath::Abs(px[0]); + Double_t y; + + if (x < 4.0) { + y = 100.78 - 1.8353 * x * x; + } else if (x < 7.3) { + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + } else { + y = 0.; + } + + if (y < 0) + y = 0; + + return y; +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPP4(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // + // pp 3.94 TeV + // rescaling of YJpsiPP(14 TeV) using 3.94 TeV / 14 TeV ratio of y-spectra in + // LO QCD + // + Double_t c[5] = {4.00785e+02, -1.41159e+01, -3.28599e+01, 5.53048e+00, + -2.45151e-01}; + Double_t x = TMath::Abs(px[0]); + Double_t y; + + if (x < 5.5) { + y = 107.389 - 2.7454 * x * x; + } else if (x < 7.0) { + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + } else { + y = 0.; + } + + if (y < 0) + y = 0; + + return y; +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPP3(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + return GeneratorParamMUONlib::YJpsiPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPP2(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // pp 1.96 TeV + // + return YJpsiPPdummy(*px, 1960); +} + +Double_t GeneratorParamMUONlib::YJpsiPP(const Double_t *px, + const Double_t * /*dummy*/) { + + // + // J/Psi y + // + // + // R. Vogt 2002 + // pp 14 TeV + // MRST HO + // mc = 1.4 GeV, pt-kick 1 GeV + // + + Double_t c[5] = {1.38532e+00, 1.00596e+02, -3.46378e+01, 3.94172e+00, + -1.48319e-01}; + Double_t x = TMath::Abs(px[0]); + Double_t y; + + if (x < 2.5) { + y = 96.455 - 0.8483 * x * x; + } else if (x < 7.9) { + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + } else { + y = 0.; + } + + return y; +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPPb9(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // + // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.79 + // + Double_t c[7] = {7.52296e-01, 2.49917e-02, 3.36500e-03, 1.91187e-03, + 2.92154e-04, -4.16509e-05, -7.62709e-06}; + Double_t y; + Double_t x = px[0] + 0.47; // rapidity shift + Int_t j; + y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + + return y * GeneratorParamMUONlib::YJpsiCDFscaledPP9dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPbP9(const Double_t *px, + const Double_t * /*dummy*/) { + // J/Psi y + // + // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.79 + // + Double_t c[7] = {7.52296e-01, 2.49917e-02, 3.36500e-03, 1.91187e-03, + 2.92154e-04, -4.16509e-05, -7.62709e-06}; + Double_t y; + Double_t x = -px[0] + 0.47; // rapidity shift + Int_t j; + y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + + return y * GeneratorParamMUONlib::YJpsiCDFscaledPP9dummy(x); +} + +Double_t GeneratorParamMUONlib::YJpsiCDFscaledPbPb4(const Double_t *px, + const Double_t *dummy) { + // J/Psi y + // + // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.66 + // + Double_t c[4] = {5.95228e-01, 9.45069e-03, 2.44710e-04, -1.32894e-05}; + Double_t x = px[0] * px[0]; + Double_t y; + Int_t j; + y = c[j = 3]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + + return y * GeneratorParamMUONlib::YJpsiCDFscaledPP4(px, dummy); +} + +Double_t GeneratorParamMUONlib::YJpsiBPbPb(const Double_t *px, + const Double_t * /*dummy*/) { + + // + // J/Psi from B->J/Psi X + // + // + + Double_t c[7] = {7.37025e-02, 0., -2.94487e-03, 0., + 6.07953e-06, 0., 5.39219e-07}; + + Double_t x = TMath::Abs(px[0]); + Double_t y; + + if (x > 6.) { + y = 0.; + } else { + Int_t j; + y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + } + + return y; +} + +// particle composition +// +Int_t GeneratorParamMUONlib::IpJpsi(TRandom *) { + // J/Psi composition + return 443; +} +Int_t GeneratorParamMUONlib::IpPsiP(TRandom *) { + // Psi prime composition + return 100443; +} +Int_t GeneratorParamMUONlib::IpJpsiFamily(TRandom *) { + // J/Psi composition + Int_t ip; + Float_t r = gRandom->Rndm(); + if (r < 0.98) { + ip = 443; + } else { + ip = 100443; + } + return ip; +} + +// Upsilon +// +// +// pt-distribution +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtUpsilonPPdummy(Double_t x, Double_t energy) { + // Upsilon pT + // pp + // from the fit of CDF & LHC data, like for J/Psi in arXiv:1103.2394 + // + const Double_t kpt0 = 1.96 * TMath::Power(energy, 0.095); + const Double_t kxn = 3.4; + // + Double_t pass1 = 1. + 0.471 * (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPP7000(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // pp 7 TeV + // + return PtUpsilonPPdummy(*px, 7000); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPP8000(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // pp 8 TeV + // + return PtUpsilonPPdummy(*px, 8000); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPP2760(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // pp 2.76 TeV + // + return PtUpsilonPPdummy(*px, 2760); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPP4400(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // pp 4.4 TeV + // + return PtUpsilonPPdummy(*px, 4400); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPP5030(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // pp 5.03 TeV + // + return PtUpsilonPPdummy(*px, 5030); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPP8800(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // pp 8.8 TeV + // + return PtUpsilonPPdummy(*px, 8800); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760ShFdummy(Double_t x, Int_t n) { + // Usilon shadowing factor vs pT for PbPb min. bias and 11 centr. bins + // (in 2.5 0) { + y1 = y1 * x + c1[--j]; + y2 = y2 * x + c2[j]; + } + + y1 /= 1. + c1[6] * TMath::Power(x, 6); + y2 /= 1. + c2[6] * TMath::Power(x, 6); + // + y1 = 1 + (y1 - 2) * f1[n] + (y2 + 1 - y1) * f2[n]; + if (y1 < 0) + y1 = 0; + return y1; +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, minimum bias 0-100 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 0) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c1(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 1st centrality bin 0-5 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 1) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c2(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 2nd centrality bin 5-10 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 2) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c3(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 3rd centrality bin 10-20 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 3) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c4(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 4th centrality bin 20-30 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 4) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c5(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 5th centrality bin 30-40 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 5) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c6(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 6th centrality bin 40-50 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 6) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c7(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 7th centrality bin 50-60 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 7) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c8(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 8th centrality bin 60-70 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 8) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c9(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 9th centrality bin 70-80 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 9) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c10(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 10th centrality bin 80-90 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 10) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb2760c11(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // PbPb 2.76 TeV, 11th centrality bin 90-100 % + // + return PtUpsilonPbPb2760ShFdummy(*px, 11) * PtUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb5030ShFdummy(Double_t x, Int_t n) { + // Upsilon shadowing factor vs pT for pPb min. bias and 4 centr. bins + // (in 2.5 0) + y = y * x + c[--j]; + y /= 1 + c[4] * TMath::Power(x, 4); + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb5030(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 5.03 TeV, minimum bias 0-100 % + // + return PtUpsilonPPb5030ShFdummy(*px, 0) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb5030c1(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 5.03 TeV, 1st centrality bin 0-20 % + // + return PtUpsilonPPb5030ShFdummy(*px, 1) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb5030c2(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 5.03 TeV, 2nd centrality bin 20-40 % + // + return PtUpsilonPPb5030ShFdummy(*px, 2) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb5030c3(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 5.03 TeV, 3rd centrality bin 40-60 % + // + return PtUpsilonPPb5030ShFdummy(*px, 3) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb5030c4(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 5.03 TeV, 4th centrality bin 60-100 % + // + return PtUpsilonPPb5030ShFdummy(*px, 4) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP5030ShFdummy(Double_t x, Int_t n) { + // Upsilon shadowing factor vs pT for Pbp min. bias and 4 centr. bins + // (in 2.5 0) + y = y * x + c[--j]; + y /= 1 + c[4] * TMath::Power(x, 4); + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP5030(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 5.03 TeV, minimum bias 0-100 % + // + return PtUpsilonPbP5030ShFdummy(*px, 0) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP5030c1(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 5.03 TeV, 1st centrality bin 0-20 % + // + return PtUpsilonPbP5030ShFdummy(*px, 1) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP5030c2(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 5.03 TeV, 2nd centrality bin 20-40 % + // + return PtUpsilonPbP5030ShFdummy(*px, 2) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP5030c3(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 5.03 TeV, 3rd centrality bin 40-60 % + // + return PtUpsilonPbP5030ShFdummy(*px, 3) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP5030c4(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 5.03 TeV, 4th centrality bin 60-100 % + // + return PtUpsilonPbP5030ShFdummy(*px, 4) * PtUpsilonPP5030(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb8800ShFdummy(Double_t x, Int_t n) { + // Upsilon shadowing factor vs pT for pPb min. bias and 4 centr. bins + // (in 2.5 0) + y = y * x + c[--j]; + y /= 1 + c[4] * TMath::Power(x, 4); + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb8800(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 8.8 TeV, minimum bias 0-100 % + // + return PtUpsilonPPb8800ShFdummy(*px, 0) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb8800c1(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 8.8 TeV, 1st centrality bin 0-20 % + // + return PtUpsilonPPb8800ShFdummy(*px, 1) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb8800c2(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 8.8 TeV, 2nd centrality bin 20-40 % + // + return PtUpsilonPPb8800ShFdummy(*px, 2) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb8800c3(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 8.8 TeV, 3rd centrality bin 40-60 % + // + return PtUpsilonPPb8800ShFdummy(*px, 3) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPPb8800c4(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // pPb 8.8 TeV, 4th centrality bin 60-100 % + // + return PtUpsilonPPb8800ShFdummy(*px, 4) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP8800ShFdummy(Double_t x, Int_t n) { + // Upsilon shadowing factor vs pT for Pbp min. bias and 4 centr. bins + // (in 2.5 0) + y = y * x + c[--j]; + y /= 1 + c[4] * TMath::Power(x, 4); + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP8800(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 8.8 TeV, minimum bias 0-100 % + // + return PtUpsilonPbP8800ShFdummy(*px, 0) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP8800c1(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 8.8 TeV, 1st centrality bin 0-20 % + // + return PtUpsilonPbP8800ShFdummy(*px, 1) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP8800c2(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 8.8 TeV, 2nd centrality bin 20-40 % + // + return PtUpsilonPbP8800ShFdummy(*px, 2) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP8800c3(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 8.8 TeV, 3rd centrality bin 40-60 % + // + return PtUpsilonPbP8800ShFdummy(*px, 3) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbP8800c4(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // Pbp 8.8 TeV, 4th centrality bin 60-100 % + // + return PtUpsilonPbP8800ShFdummy(*px, 4) * PtUpsilonPP8800(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilon(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + const Double_t kpt0 = 5.3; + const Double_t kxn = 2.5; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtUpsilonCDFscaled(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + const Double_t kpt0 = 7.753; + const Double_t kxn = 3.042; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t +GeneratorParamMUONlib::PtUpsilonCDFscaledPP(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // + // pp 14 TeV + // + // scaled from CDF data at 2 TeV + + const Double_t kpt0 = 8.610; + const Double_t kxn = 3.051; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t +GeneratorParamMUONlib::PtUpsilonCDFscaledPP10(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // + // pp 10 TeV + // + // scaled from CDF data at 2 TeV + + const Double_t kpt0 = 8.235; + const Double_t kxn = 3.051; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t +GeneratorParamMUONlib::PtUpsilonCDFscaledPP9(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // + // pp 8.8 TeV + // scaled from CDF data at 2 TeV + // + const Double_t kpt0 = 8.048; + const Double_t kxn = 3.051; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t +GeneratorParamMUONlib::PtUpsilonCDFscaledPP7(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // + // pp 7 TeV + // + // scaled from CDF data at 2 TeV + + const Double_t kpt0 = 7.817; + const Double_t kxn = 3.051; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t +GeneratorParamMUONlib::PtUpsilonCDFscaledPP4(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon pT + // + // pp 3.94 TeV + // scaled from CDF data at 2 TeV + // + const Double_t kpt0 = 7.189; + const Double_t kxn = 3.051; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtUpsilonCDFscaledPPb9(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // + // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.89 + // + Double_t c[5] = {7.64952e-01, 1.12501e-04, 4.96038e-04, -3.03198e-05, + 3.74035e-06}; + Double_t x = *px; + Double_t y; + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + // + Double_t d = 1. + c[4] * TMath::Power(x, 4); + return y / d * GeneratorParamMUONlib::PtUpsilonCDFscaledPP9(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonCDFscaledPbP9(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // + // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.89 + // + Double_t c[5] = {1.09881e+00, 3.08329e-03, -2.00356e-04, 8.28991e-06, + 2.52576e-06}; + Double_t x = *px; + Double_t y; + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + // + Double_t d = 1. + c[4] * TMath::Power(x, 4); + return y / d * GeneratorParamMUONlib::PtUpsilonCDFscaledPP9(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonCDFscaledPbPb4(const Double_t *px, + const Double_t *dummy) { + // Upsilon pT + // + // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.85 + // + Double_t c[5] = {8.65872e-01, 2.05465e-03, 2.56063e-04, -1.65598e-05, + 2.29209e-06}; + Double_t x = *px; + Double_t y; + Int_t j; + y = c[j = 4]; + while (j > 0) + y = y * x + c[--j]; + // + Double_t d = 1. + c[4] * TMath::Power(x, 4); + return y / d * GeneratorParamMUONlib::PtUpsilonCDFscaledPP4(px, dummy); +} + +Double_t GeneratorParamMUONlib::PtUpsilonFlat(const Double_t * /*px*/, + const Double_t * /*dummy*/) { + return 1.; +} + +Double_t GeneratorParamMUONlib::PtUpsilonPbPb(const Double_t *px, + const Double_t * /*dummy*/) { + // + // Upsilon pT + // + // + // R. Vogt 2002 + // PbPb 5.5 TeV + // MRST HO + // mc = 1.4 GeV, pt-kick 1 GeV + // + Float_t x = px[0]; + Double_t c[8] = {-1.03488e+01, 1.28065e+01, -6.60500e+00, 1.66140e+00, + -2.34293e-01, 1.86925e-02, -7.80708e-04, 1.30610e-05}; + Double_t y; + if (x < 10.) { + Int_t j; + y = c[j = 7]; + while (j > 0) + y = y * x + c[--j]; + y = x * TMath::Exp(y); + } else { + y = 0.; + } + return y; +} + +Double_t GeneratorParamMUONlib::PtUpsilonPP(const Double_t *px, + const Double_t * /*dummy*/) { + // + // Upsilon pT + // + // + // R. Vogt 2002 + // pp 14 TeV + // MRST HO + // mc = 1.4 GeV, pt-kick 1 GeV + // + Float_t x = px[0]; + Double_t c[8] = {-7.93955e+00, 1.06306e+01, -5.21392e+00, 1.19703e+00, + -1.45718e-01, 8.95151e-03, -2.04806e-04, -1.13053e-06}; + + Double_t y; + if (x < 10.) { + Int_t j; + y = c[j = 7]; + while (j > 0) + y = y * x + c[--j]; + y = x * TMath::Exp(y); + } else { + y = 0.; + } + return y; +} + +// +// y-distribution +// +//____________________________________________________________ +Double_t GeneratorParamMUONlib::YUpsilonPPdummy(Double_t x, Double_t energy) { + // Upsilon y + // pp + // from the fit of CDF & LHC data, like for J/Psi in arXiv:1103.2394 + // + x = x / TMath::Log(energy / 9.46); + x = x * x; + Double_t y = TMath::Exp(-x / 0.4 / 0.4 / 2); + if (x > 1) + y = 0; + return y; +} + +Double_t GeneratorParamMUONlib::YUpsilonPPpoly(Double_t x, Double_t energy) { + // Upsilon y + // pp + // from the fit of CDF & LHC data, like for J/Psi in arXiv:1103.2394 + // + x = x / TMath::Log(energy / 9.46); + x = x * x; + Double_t y = 1 - 6.9 * x * x; + if (y < 0) + y = 0; + return y; +} + +Double_t GeneratorParamMUONlib::YUpsilonPP7000(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pp 7 TeV + // + return YUpsilonPPdummy(*px, 7000); +} + +Double_t GeneratorParamMUONlib::YUpsilonPP8000(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pp 7 TeV + // + return YUpsilonPPdummy(*px, 8000); +} + +Double_t GeneratorParamMUONlib::YUpsilonPP2760(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pp 2.76 TeV + // + return YUpsilonPPdummy(*px, 2760); +} + +Double_t GeneratorParamMUONlib::YUpsilonPP4400(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pp 4.4 TeV + // + return YUpsilonPPdummy(*px, 4400); +} + +Double_t GeneratorParamMUONlib::YUpsilonPP5030(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pp 5.03 TeV + // + return YUpsilonPPdummy(*px, 5030); +} + +Double_t GeneratorParamMUONlib::YUpsilonPP8800(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pp 8.8 TeV + // + return YUpsilonPPdummy(*px, 8800); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPpoly7000(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pp 7 TeV + // + return YUpsilonPPpoly(*px, 7000); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPpoly2760(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pp 2.76 TeV + // + return YUpsilonPPpoly(*px, 2760); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760ShFdummy(Double_t x, Int_t n) { + // Upsilon shadowing factor vs y for PbPb min. bias and 11 centr. bins + // + // PbPb 2.76 TeV, for EKS98, minimum bias shadowing factor = 0.87 in 4pi + // + const Double_t f1[12] = {1, 1.128, 1.097, 1.037, 0.937, 0.821, + 0.693, 0.558, 0.428, 0.317, 0.231, 0.156}; + const Double_t f2[12] = {1, 1.313, 1.202, 1.039, 0.814, 0.593, + 0.391, 0.224, 0.106, 0.041, 0.013, 0.002}; + const Double_t c1[5] = {1.8547e+00, 1.6717e-02, -2.1285e-04, -9.7662e-05, + 2.5768e-06}; + const Double_t c2[5] = {8.6029e-01, 1.1742e-02, -2.7944e-04, -6.7973e-05, + 1.8838e-06}; + + x = x * x; + Double_t y1, y2; + Int_t j; + y1 = c1[j = 4]; + y2 = c2[4]; + while (j > 0) { + y1 = y1 * x + c1[--j]; + y2 = y2 * x + c2[j]; + } + + y1 = 1 + (y1 - 2) * f1[n] + (y2 + 1 - y1) * f2[n]; + if (y1 < 0) + y1 = 0; + return y1; +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, minimum bias 0-100 % + // + return YUpsilonPbPb2760ShFdummy(*px, 0) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c1(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 1st centrality bin 0-5 % + // + return YUpsilonPbPb2760ShFdummy(*px, 1) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c2(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 2nd centrality bin 5-10 % + // + return YUpsilonPbPb2760ShFdummy(*px, 2) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c3(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 3rd centrality bin 10-20 % + // + return YUpsilonPbPb2760ShFdummy(*px, 3) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c4(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 4th centrality bin 20-30 % + // + return YUpsilonPbPb2760ShFdummy(*px, 4) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c5(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 5th centrality bin 30-40 % + // + return YUpsilonPbPb2760ShFdummy(*px, 5) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c6(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 6th centrality bin 40-50 % + // + return YUpsilonPbPb2760ShFdummy(*px, 6) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c7(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 7th centrality bin 50-60 % + // + return YUpsilonPbPb2760ShFdummy(*px, 7) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c8(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 8th centrality bin 60-70 % + // + return YUpsilonPbPb2760ShFdummy(*px, 8) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c9(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 9th centrality bin 70-80 % + // + return YUpsilonPbPb2760ShFdummy(*px, 9) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c10(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 10th centrality bin 80-90 % + // + return YUpsilonPbPb2760ShFdummy(*px, 10) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb2760c11(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // PbPb 2.76 TeV, 11th centrality bin 90-100 % + // + return YUpsilonPbPb2760ShFdummy(*px, 11) * YUpsilonPP2760(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonPP5030dummy(Double_t px) { + return GeneratorParamMUONlib::YUpsilonPP5030(&px, (Double_t *)0); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb5030ShFdummy(Double_t x, Int_t n) { + // Upsilon shadowing factor vs y for pPb min. bias and 4 centr. bins + // + // pPb 5.03 TeV, for EPS09-LO, minimum bias shadowing factor = 0.92 in 4pi + // + const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23}; + const Double_t c[7] = {8.885e-01, 4.620e-02, 1.158e-02, 4.959e-04, + -4.422e-04, -5.345e-05, 0.}; + Double_t y; + Int_t j; + y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb5030(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 5.03 TeV, minimum bias 0-100 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 0) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb5030c1(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 5.03 TeV, 1st centrality bin 0-20 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 1) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb5030c2(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 5.03 TeV, 2nd centrality bin 20-40 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 2) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb5030c3(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 5.03 TeV, 3rd centrality bin 40-60 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 3) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb5030c4(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 5.03 TeV, 4th centrality bin 60-100 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 4) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP5030(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 5.03 TeV, minimum bias 0-100 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 0) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP5030c1(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 5.03 TeV, 1st centrality bin 0-20 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 1) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP5030c2(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 5.03 TeV, 2nd centrality bin 20-40 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 2) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP5030c3(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 5.03 TeV, 3rd centrality bin 40-60 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 3) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP5030c4(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 5.03 TeV, 4th centrality bin 60-100 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb5030ShFdummy(x, 4) * YUpsilonPP5030dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPP8800dummy(Double_t px) { + return GeneratorParamMUONlib::YUpsilonPP8800(&px, (Double_t *)0); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb8800ShFdummy(Double_t x, Int_t n) { + // Upsilon shadowing factor vs y for pPb min. bias and 4 centr. bins + // + // pPb 8.8 TeV, for EKS98, minimum bias shadowing factor = 0.89 in 4pi + // + const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23}; + const Double_t c[7] = {8.6581e-01, 4.6111e-02, 7.6911e-03, 8.7313e-04, + -1.4700e-04, -5.0975e-05, -3.5718e-06}; + Double_t y; + Int_t j; + y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + // + return 1 + (y - 1) * f[n]; +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb8800(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 8.8 TeV, minimum bias 0-100 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 0) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb8800c1(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 8.8 TeV, 1st centrality bin 0-20 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 1) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb8800c2(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 8.8 TeV, 2nd centrality bin 20-40 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 2) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb8800c3(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 8.8 TeV, 3rd centrality bin 40-60 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 3) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPPb8800c4(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // pPb 8.8 TeV, 4th centrality bin 60-100 % + // + Double_t x = px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 4) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP8800(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 8.8 TeV, minimum bias 0-100 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 0) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP8800c1(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 8.8 TeV, 1st centrality bin 0-20 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 1) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP8800c2(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 8.8 TeV, 2nd centrality bin 20-40 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 2) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP8800c3(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 8.8 TeV, 3rd centrality bin 40-60 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 3) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonPbP8800c4(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // Pbp 8.8 TeV, 4th centrality bin 60-100 % + // + Double_t x = -px[0] + 0.47; // rapidity shift + return YUpsilonPPb8800ShFdummy(x, 4) * YUpsilonPP8800dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilon(const Double_t *py, + const Double_t * /*dummy*/) { + // Upsilon y + const Double_t ky0 = 3.; + const Double_t kb = 1.; + Double_t yu; + Double_t y = TMath::Abs(*py); + // + if (y < ky0) + yu = kb; + else + yu = kb * TMath::Exp(-(y - ky0) * (y - ky0) / 2); + return yu; +} + +Double_t GeneratorParamMUONlib::YUpsilonPbPb(const Double_t *px, + const Double_t * /*dummy*/) { + + // + // Upsilon y + // + // + // R. Vogt 2002 + // PbPb 5.5 TeV + // MRST HO + // mc = 1.4 GeV, pt-kick 1 GeV + // + + Double_t c[7] = {3.40036e-01, -3.98882e-07, -4.48398e-03, 8.46411e-08, + -6.10854e-04, -2.99753e-09, 1.28895e-05}; + Double_t x = TMath::Abs(px[0]); + if (x > 5.55) + return 0.; + Int_t j; + Double_t y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + return y; +} + +Double_t GeneratorParamMUONlib::YUpsilonCDFscaled(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + return GeneratorParamMUONlib::YUpsilonPbPb(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonCDFscaledPP(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + return GeneratorParamMUONlib::YUpsilonPP(px, dummy); +} + +Double_t GeneratorParamMUONlib::YUpsilonFlat(const Double_t * /*px*/, + const Double_t * /*dummy*/) { + // Upsilon y + return 1.; +} + +Double_t +GeneratorParamMUONlib::YUpsilonCDFscaledPP10(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // + // pp 10 TeV + // scaled from YUpsilonPP(14 TeV) using 10 TeV / 14 TeV ratio of y-spectra in + // LO pQCD. see S.Grigoryan, PWG3 Meeting, 27th Oct 2008 + // + Double_t c[4] = {1., -2.17877e-02, -6.52830e-04, 1.40578e-05}; + Double_t x = TMath::Abs(px[0]); + if (x > 6.1) + return 0.; + Int_t j; + Double_t y = c[j = 3]; + while (j > 0) + y = y * x * x + c[--j]; + return y; +} + +Double_t +GeneratorParamMUONlib::YUpsilonCDFscaledPP9(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // + // pp 8.8 TeV + // rescaling of YUpsilonPP(14 TeV) using 8.8 TeV / 14 TeV ratio of y-spectra + // in LO QCD + // + Double_t c[4] = {1., -2.37621e-02, -6.29610e-04, 1.47976e-05}; + Double_t x = TMath::Abs(px[0]); + if (x > 6.1) + return 0.; + Int_t j; + Double_t y = c[j = 3]; + while (j > 0) + y = y * x * x + c[--j]; + return y; +} + +Double_t GeneratorParamMUONlib::YUpsilonCDFscaledPP9dummy(Double_t px) { + return GeneratorParamMUONlib::YUpsilonCDFscaledPP9(&px, (Double_t *)0); +} + +Double_t +GeneratorParamMUONlib::YUpsilonCDFscaledPP7(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // + // pp 7 TeV + // scaled from YUpsilonPP(14 TeV) using 7 TeV / 14 TeV ratio of y-spectra in + // LO pQCD. + // + Double_t c[4] = {1., -2.61009e-02, -6.83937e-04, 1.78451e-05}; + Double_t x = TMath::Abs(px[0]); + if (x > 6.0) + return 0.; + Int_t j; + Double_t y = c[j = 3]; + while (j > 0) + y = y * x * x + c[--j]; + return y; +} + +Double_t +GeneratorParamMUONlib::YUpsilonCDFscaledPP4(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // + // pp 3.94 TeV + // rescaling of YUpsilonPP(14 TeV) using 3.94 TeV / 14 TeV ratio of y-spectra + // in LO QCD + // + Double_t c[4] = {1., -3.91924e-02, -4.26184e-04, 2.10914e-05}; + Double_t x = TMath::Abs(px[0]); + if (x > 5.7) + return 0.; + Int_t j; + Double_t y = c[j = 3]; + while (j > 0) + y = y * x * x + c[--j]; + + return y; +} + +Double_t GeneratorParamMUONlib::YUpsilonPP(const Double_t *px, + const Double_t * /*dummy*/) { + + // + // Upsilon y + // + // + // R. Vogt 2002 + // p p 14. TeV + // MRST HO + // mc = 1.4 GeV, pt-kick 1 GeV + // + Double_t c[7] = {8.91936e-01, -6.46645e-07, -1.52774e-02, 4.28677e-08, + -7.01517e-04, -6.20539e-10, 1.29943e-05}; + Double_t x = TMath::Abs(px[0]); + if (x > 6.2) + return 0.; + Int_t j; + Double_t y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + return y; +} + +Double_t +GeneratorParamMUONlib::YUpsilonCDFscaledPPb9(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // + // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.89 + // + Double_t c[7] = {8.71829e-01, 4.77467e-02, 8.09671e-03, 6.45294e-04, + -2.15730e-04, -4.67538e-05, -2.11683e-06}; + Double_t y; + Double_t x = px[0] + 0.47; // rapidity shift + Int_t j; + y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + + return y * GeneratorParamMUONlib::YUpsilonCDFscaledPP9dummy(x); +} + +Double_t +GeneratorParamMUONlib::YUpsilonCDFscaledPbP9(const Double_t *px, + const Double_t * /*dummy*/) { + // Upsilon y + // + // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.89 + // + Double_t c[7] = {8.71829e-01, 4.77467e-02, 8.09671e-03, 6.45294e-04, + -2.15730e-04, -4.67538e-05, -2.11683e-06}; + Double_t y; + Double_t x = -px[0] + 0.47; // rapidity shift + Int_t j; + y = c[j = 6]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + + return y * GeneratorParamMUONlib::YUpsilonCDFscaledPP9dummy(x); +} + +Double_t GeneratorParamMUONlib::YUpsilonCDFscaledPbPb4(const Double_t *px, + const Double_t *dummy) { + // Upsilon y + // + // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.85 + // + Double_t c[4] = {8.27837e-01, 1.70115e-02, -1.26046e-03, 1.52091e-05}; + Double_t x = px[0] * px[0]; + Double_t y; + Int_t j; + y = c[j = 3]; + while (j > 0) + y = y * x + c[--j]; + if (y < 0) + y = 0; + + return y * GeneratorParamMUONlib::YUpsilonCDFscaledPP4(px, dummy); +} + +// particle composition +// +Int_t GeneratorParamMUONlib::IpUpsilon(TRandom *) { + // y composition + return 553; +} +Int_t GeneratorParamMUONlib::IpUpsilonP(TRandom *) { + // y composition + return 100553; +} +Int_t GeneratorParamMUONlib::IpUpsilonPP(TRandom *) { + // y composition + return 200553; +} +Int_t GeneratorParamMUONlib::IpUpsilonFamily(TRandom *) { + // y composition + // Using the LHCb pp data at 7 TeV: CERN-PH-EP-2012-051 + // (L. Manceau, S. Grigoryan) + Int_t ip; + Float_t r = gRandom->Rndm(); + if (r < 0.687) { + // if (r < 0.712) { + ip = 553; + } else if (r < 0.903) { + // } else if (r < 0.896) { + ip = 100553; + } else { + ip = 200553; + } + return ip; +} + +// +// Phi +// +// +// pt-distribution (by scaling of pion distribution) +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtPhi(const Double_t *px, + const Double_t * /*dummy*/) { + // Phi pT + return PtScal(*px, 7); +} +// y-distribution +Double_t GeneratorParamMUONlib::YPhi(const Double_t *px, + const Double_t * /*dummy*/) { + // Phi y + Double_t *dum = 0; + return YJpsi(px, dum); +} +// particle composition +// +Int_t GeneratorParamMUONlib::IpPhi(TRandom *) { + // Phi composition + return 333; +} + +// +// omega +// +// +// pt-distribution (by scaling of pion distribution) +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtOmega(const Double_t *px, + const Double_t * /*dummy*/) { + // Omega pT + return PtScal(*px, 5); +} +// y-distribution +Double_t GeneratorParamMUONlib::YOmega(const Double_t *px, + const Double_t * /*dummy*/) { + // Omega y + Double_t *dum = 0; + return YJpsi(px, dum); +} +// particle composition +// +Int_t GeneratorParamMUONlib::IpOmega(TRandom *) { + // Omega composition + return 223; +} + +// +// omega +// +// +// pt-distribution (by scaling of pion distribution) +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtRho(const Double_t *px, + const Double_t * /*dummy*/) { + // Rho pT + return PtScal(*px, 5); +} +// y-distribution +Double_t GeneratorParamMUONlib::YRho(const Double_t *px, + const Double_t * /*dummy*/) { + // Rho y + Double_t *dum = 0; + return YJpsi(px, dum); +} +// particle composition +// +Int_t GeneratorParamMUONlib::IpRho(TRandom *) { + // Rho composition + return 113; +} + +// +// Eta +// +// +// pt-distribution (by scaling of pion distribution) +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtEta(const Double_t *px, + const Double_t * /*dummy*/) { + // Eta pT + return PtScal(*px, 3); +} +// y-distribution +Double_t GeneratorParamMUONlib::YEta(const Double_t *px, + const Double_t * /*dummy*/) { + // Eta y + Double_t *dum = 0; + return YJpsi(px, dum); +} +// particle composition +// +Int_t GeneratorParamMUONlib::IpEta(TRandom *) { + // Eta composition + return 221; +} + +// +// Charm +// +// +// pt-distribution +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtCharm(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + const Double_t kpt0 = 2.25; + const Double_t kxn = 3.17; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtCharmCentral(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + const Double_t kpt0 = 2.12; + const Double_t kxn = 2.78; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtCharmF0M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows: + // PtCharmFiMjSkPP = PtCharmF0M0S0PP * (dN(i,j,k)/dpt / dN(0,0,0)/dpt)_MNR + // i=0,1,2; j=0,1,2; k=0,1,...,6 + // dN(i,j,k)/dpt - spectra obtained by A.Dainese (hep-ph/0601164, p.88; + // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) + // calculations for the following inputs: + // Peterson fragmentation function (F) with \epsilon_c = 0.02, 0.002 & 0.11 + // for i=0,1 & 2 respectively; quark mass (M) of 1.5, 1.3 & 1.7 GeV + // for j=0,1 & 2 respectively; + // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) + // with a/b = 1/1, 1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 + // for k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set + // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89). + // June 2008, Smbat.Grigoryan@cern.ch + + // Charm pT + // Pythia6.214 (kCharmppMNRwmi, PDF = CTEQ5L, quark mass = 1.2 GeV, PtHard + // > 2.76 GeV/c) for pp collisions at 14 TeV with one c-cbar pair per event. + // Corresponding NLO total cross section is 5.68 mb + + const Double_t kpt0 = 2.2930; + const Double_t kxn = 3.1196; + Double_t c[3] = {-5.2180e-01, 1.8753e-01, 2.8669e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF1M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 6.06 mb + const Double_t kpt0 = 2.8669; + const Double_t kxn = 3.1044; + Double_t c[3] = {-4.6714e-01, 1.5005e-01, 4.5003e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF2M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 6.06 mb + const Double_t kpt0 = 1.8361; + const Double_t kxn = 3.2966; + Double_t c[3] = {-6.1550e-01, 2.6498e-01, 1.0728e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF0M1S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 7.69 mb + const Double_t kpt0 = 2.1280; + const Double_t kxn = 3.1397; + Double_t c[3] = {-5.4021e-01, 2.0944e-01, 2.5211e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF0M2S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 4.81 mb + const Double_t kpt0 = 2.4579; + const Double_t kxn = 3.1095; + Double_t c[3] = {-5.1497e-01, 1.7532e-01, 3.2429e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF0M0S1PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 14.09 mb + const Double_t kpt0 = 2.1272; + const Double_t kxn = 3.1904; + Double_t c[3] = {-4.6088e-01, 2.1918e-01, 2.3055e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF0M0S2PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 1.52 mb + const Double_t kpt0 = 2.8159; + const Double_t kxn = 3.0857; + Double_t c[3] = {-6.4691e-01, 2.0289e-01, 2.4922e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF0M0S3PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 3.67 mb + const Double_t kpt0 = 2.7297; + const Double_t kxn = 3.3019; + Double_t c[3] = {-6.2216e-01, 1.9031e-01, 1.5341e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF0M0S4PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 3.38 mb + const Double_t kpt0 = 2.3894; + const Double_t kxn = 3.1075; + Double_t c[3] = {-4.9742e-01, 1.7032e-01, 2.5994e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF0M0S5PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 10.37 mb + const Double_t kpt0 = 2.0187; + const Double_t kxn = 3.3011; + Double_t c[3] = {-3.9869e-01, 2.9248e-01, 1.1763e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} +Double_t GeneratorParamMUONlib::PtCharmF0M0S6PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm pT + // Corresponding NLO total cross section is 7.22 mb + const Double_t kpt0 = 2.1089; + const Double_t kxn = 3.1848; + Double_t c[3] = {-4.6275e-01, 1.8114e-01, 2.1363e-02}; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn) * (1. + c[0] * x + c[1] * x * x) / + (1. + c[2] * x * x); +} + +// y-distribution +Double_t GeneratorParamMUONlib::YCharm(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y :: Carrer & Dainese : ALICE-INT-2003-019 v.3 (hep-ph/0311225) + // Pythia tuned to reproduce the distribution given by the HVQMNR program + // based on NLO calculations (pQCD) shadowing + kt broadening + + Double_t x = px[0]; + Double_t c[2] = {-2.42985e-03, -2.31001e-04}; + Double_t y = 1 + (c[0] * TMath::Power(x, 2)) + (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 8) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF0M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows: + // YCharmFiMjSkPP = YCharmF0M0S0PP * (dN(i,j,k)/dy / dN(0,0,0)/dy)_MNR + // i=0,1,2; j=0,1,2; k=0,1,...,6 + // dN(i,j,k)/dy - spectra obtained by A.Dainese (hep-ph/0601164, p.88; + // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) + // calculations for the following inputs: + // Peterson fragmentation function (F) with \epsilon_c = 0.02, 0.002 & 0.11 + // for i=0,1 & 2 respectively; quark mass (M) of 1.5, 1.3 & 1.7 GeV + // for j=0,1 & 2 respectively; + // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) + // with a/b = 1/1,1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 for + // k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set + // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89). + // June 2008, Smbat.Grigoryan@cern.ch + + // Charm y + // Pythia6.214 (kCharmppMNRwmi, PDF = CTEQ5L, quark mass = 1.2 GeV, PtHard + // > 2.76 GeV/c) for pp collisions at 14 TeV with one c-cbar pair per event. + // Corresponding NLO total cross section is 5.68 mb + + Double_t x = px[0]; + Double_t c[2] = {7.0909e-03, 6.1967e-05}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF1M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 6.06 mb + Double_t x = px[0]; + Double_t c[2] = {6.9707e-03, 6.0971e-05}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF2M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 6.06 mb + Double_t x = px[0]; + Double_t c[2] = {7.1687e-03, 6.5303e-05}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF0M1S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 7.69 mb + Double_t x = px[0]; + Double_t c[2] = {5.9090e-03, 7.1854e-05}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF0M2S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 4.81 mb + Double_t x = px[0]; + Double_t c[2] = {8.0882e-03, 5.5872e-05}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF0M0S1PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 14.09 mb + Double_t x = px[0]; + Double_t c[2] = {7.2520e-03, 6.2691e-05}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF0M0S2PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 1.52 mb + Double_t x = px[0]; + Double_t c[2] = {1.1040e-04, 1.4498e-04}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF0M0S3PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 3.67 mb + Double_t x = px[0]; + Double_t c[2] = {-3.1328e-03, 1.8270e-04}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF0M0S4PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 3.38 mb + Double_t x = px[0]; + Double_t c[2] = {7.0865e-03, 6.2532e-05}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF0M0S5PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 10.37 mb + Double_t x = px[0]; + Double_t c[2] = {7.7070e-03, 5.3533e-05}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} +Double_t GeneratorParamMUONlib::YCharmF0M0S6PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Charm y + // Corresponding NLO total cross section is 7.22 mb + Double_t x = px[0]; + Double_t c[2] = {7.9195e-03, 5.3823e-05}; + Double_t y = 1 - (c[0] * TMath::Power(x, 2)) - (c[1] * TMath::Power(x, 4)); + Double_t ycharm; + + if (TMath::Abs(x) > 9) { + ycharm = 0.; + } else { + ycharm = TMath::Power(y, 3); + } + + return ycharm; +} + +Int_t GeneratorParamMUONlib::IpCharm(TRandom *ran) { + // Charm composition + Float_t random; + Int_t ip; + // 411,421,431,4122 + random = ran->Rndm(); + // Taux de production Carrer & Dainese : ALICE-INT-2003-019 v.3 + // >>>>> cf. tab 4 p 11 + + if (random < 0.30) { + ip = 421; + } else if (random < 0.60) { + ip = -421; + } else if (random < 0.70) { + ip = 411; + } else if (random < 0.80) { + ip = -411; + } else if (random < 0.86) { + ip = 431; + } else if (random < 0.92) { + ip = -431; + } else if (random < 0.96) { + ip = 4122; + } else { + ip = -4122; + } + + return ip; +} + +// +// Beauty +// +// +// pt-distribution +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtBeauty(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + const Double_t kpt0 = 6.53; + const Double_t kxn = 3.59; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +Double_t GeneratorParamMUONlib::PtBeautyCentral(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + const Double_t kpt0 = 6.14; + const Double_t kxn = 2.93; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF0M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows: + // PtBeautyFiMjSkPP = PtBeautyF0M0S0PP * (dN(i,j,k)/dpt / dN(0,0,0)/dpt)_MNR + // i=0,1,2; j=0,1,2; k=0,1,...,6 + // dN(i,j,k)/dpt - spectra obtained by A.Dainese (hep-ph/0601164, p.88; + // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) + // calculations for the following inputs: + // Peterson fragmentation function (F) with \epsilon_b = 0.001, 0.0002 & 0.004 + // for i=0,1 & 2 respectively; quark mass (M) of 4.75, 4.5 & 5.0 GeV + // for j=0,1 & 2 respectively; + // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) + // with a/b = 1/1, 1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 for + // k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set + // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89). + // June 2008, Smbat.Grigoryan@cern.ch + + // Beauty pT + // Pythia6.214 (kBeautyppMNRwmi, PDF = CTEQ5L, quark mass = 4.75 GeV, PtHard + // > 2.76 GeV/c) for pp collisions at 14 TeV with one b-bbar pair per event. + // Corresponding NLO total cross section is 0.494 mb + + const Double_t kpt0 = 8.0575; + const Double_t kxn = 3.1921; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF1M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.445 mb + const Double_t kpt0 = 8.6239; + const Double_t kxn = 3.2911; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF2M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.445 mb + const Double_t kpt0 = 7.3367; + const Double_t kxn = 3.0692; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF0M1S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.518 mb + const Double_t kpt0 = 7.6409; + const Double_t kxn = 3.1364; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF0M2S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.384 mb + const Double_t kpt0 = 8.4948; + const Double_t kxn = 3.2546; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF0M0S1PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.648 mb + const Double_t kpt0 = 7.6631; + const Double_t kxn = 3.1621; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF0M0S2PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.294 mb + const Double_t kpt0 = 8.7245; + const Double_t kxn = 3.2213; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF0M0S3PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.475 mb + const Double_t kpt0 = 8.5296; + const Double_t kxn = 3.2187; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF0M0S4PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.324 mb + const Double_t kpt0 = 7.9440; + const Double_t kxn = 3.1614; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF0M0S5PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.536 mb + const Double_t kpt0 = 8.2408; + const Double_t kxn = 3.3029; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtBeautyF0M0S6PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty pT + // Corresponding NLO total cross section is 0.420 mb + const Double_t kpt0 = 7.8041; + const Double_t kxn = 3.2094; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +// y-distribution +Double_t GeneratorParamMUONlib::YBeauty(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y :: Carrer & Dainese : ALICE-INT-2003-019 v.3 (hep-ph/0311225) + // Pythia tuned to reproduce the distribution given by the HVQMNR program + // based on NLO calculations (pQCD) shadowing + kt broadening + + Double_t x = px[0]; + Double_t c[2] = {-1.27590e-02, -2.42731e-04}; + Double_t y = 1 + c[0] * TMath::Power(x, 2) + c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF0M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows: + // YBeautyFiMjSkPP = YBeautyF0M0S0PP * (dN(i,j,k)/dy / dN(0,0,0)/dy)_MNR + // i=0,1,2; j=0,1,2; k=0,1,...,6 + // dN(i,j,k)/dy - spectra obtained by A.Dainese (hep-ph/0601164, p.88; + // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) + // calculations for the following inputs: + // Peterson fragmentation function (F) with \epsilon_b = 0.001, 0.0002 & 0.004 + // for i=0,1 & 2 respectively; quark mass (M) of 4.75, 4.5 & 5.0 GeV + // for j=0,1 & 2 respectively; + // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) + // with a/b = 1/1, 1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 + // for k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set + // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89). + // June 2008, Smbat.Grigoryan@cern.ch + + // Beauty y + // Pythia6.214 (kBeautyppMNRwmi, PDF = CTEQ5L, quark mass = 4.75 GeV, PtHard + // > 2.76 GeV/c) for pp collisions at 14 TeV with one b-bbar pair per event. + // Corresponding NLO total cross section is 0.494 mb + + Double_t x = px[0]; + Double_t c[2] = {1.2350e-02, 9.2667e-05}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF1M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.445 mb + Double_t x = px[0]; + Double_t c[2] = {1.2292e-02, 9.1847e-05}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF2M0S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.445 mb + Double_t x = px[0]; + Double_t c[2] = {1.2436e-02, 9.3709e-05}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF0M1S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.518 mb + Double_t x = px[0]; + Double_t c[2] = {1.1714e-02, 1.0068e-04}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF0M2S0PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.384 mb + Double_t x = px[0]; + Double_t c[2] = {1.2944e-02, 8.5500e-05}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF0M0S1PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.648 mb + Double_t x = px[0]; + Double_t c[2] = {1.2455e-02, 9.2713e-05}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF0M0S2PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.294 mb + Double_t x = px[0]; + Double_t c[2] = {1.0897e-02, 1.1878e-04}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF0M0S3PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.475 mb + Double_t x = px[0]; + Double_t c[2] = {1.0912e-02, 1.1858e-04}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF0M0S4PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.324 mb + Double_t x = px[0]; + Double_t c[2] = {1.2378e-02, 9.2490e-05}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF0M0S5PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.536 mb + Double_t x = px[0]; + Double_t c[2] = {1.2886e-02, 8.2912e-05}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} +Double_t GeneratorParamMUONlib::YBeautyF0M0S6PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Beauty y + // Corresponding NLO total cross section is 0.420 mb + Double_t x = px[0]; + Double_t c[2] = {1.3106e-02, 8.0115e-05}; + Double_t y = 1 - c[0] * TMath::Power(x, 2) - c[1] * TMath::Power(x, 4); + Double_t ybeauty; + + if (TMath::Abs(x) > 7.6) { + ybeauty = 0.; + } else { + ybeauty = TMath::Power(y, 3); + } + + return ybeauty; +} + +Int_t GeneratorParamMUONlib::IpBeauty(TRandom *ran) { + // Beauty Composition + Float_t random; + Int_t ip; + random = ran->Rndm(); + + // Taux de production Carrer & Dainese : ALICE-INT-2003-019 v.3 + // >>>>> cf. tab 4 p 11 + + if (random < 0.20) { + ip = 511; + } else if (random < 0.40) { + ip = -511; + } else if (random < 0.605) { + ip = 521; + } else if (random < 0.81) { + ip = -521; + } else if (random < 0.87) { + ip = 531; + } else if (random < 0.93) { + ip = -531; + } else if (random < 0.965) { + ip = 5122; + } else { + ip = -5122; + } + + return ip; +} + +typedef Double_t (*GenFunc)(const Double_t *, const Double_t *); +GenFunc GeneratorParamMUONlib::GetPt(Int_t param, const char *tname) const { + // Return pointer to pT parameterisation + TString sname = TString(tname); + GenFunc func; + switch (param) { + case kPhi: + func = PtPhi; + break; + case kOmega: + func = PtOmega; + break; + case kEta: + func = PtEta; + break; + case kJpsiFamily: + case kPsiP: + case kChic1: + case kChic2: + case kJpsi: + if (sname == "Vogt" || sname == "Vogt PbPb") { + func = PtJpsiPbPb; + } else if (sname == "Vogt pp") { + func = PtJpsiPP; + } else if (sname == "pp 7") { + func = PtJpsiPP7000; + } else if (sname == "pp 8") { + func = PtJpsiPP8000; + } else if (sname == "pp 2.76") { + func = PtJpsiPP2760; + } else if (sname == "pp 4.4") { + func = PtJpsiPP4400; + } else if (sname == "pp 5.03") { + func = PtJpsiPP5030; + } else if (sname == "pp 8.8") { + func = PtJpsiPP8800; + } else if (sname == "pp 7 poly") { + func = PtJpsiPP7000; + } else if (sname == "pp 2.76 poly") { + func = PtJpsiPP2760; + } else if (sname == "PbPb 2.76") { + func = PtJpsiPbPb2760; + } else if (sname == "PbPb 2.76c1") { + func = PtJpsiPbPb2760c1; + } else if (sname == "PbPb 2.76c2") { + func = PtJpsiPbPb2760c2; + } else if (sname == "PbPb 2.76c3") { + func = PtJpsiPbPb2760c3; + } else if (sname == "PbPb 2.76c4") { + func = PtJpsiPbPb2760c4; + } else if (sname == "PbPb 2.76c5") { + func = PtJpsiPbPb2760c5; + } else if (sname == "PbPb 2.76c6") { + func = PtJpsiPbPb2760c6; + } else if (sname == "PbPb 2.76c7") { + func = PtJpsiPbPb2760c7; + } else if (sname == "PbPb 2.76c8") { + func = PtJpsiPbPb2760c8; + } else if (sname == "PbPb 2.76c9") { + func = PtJpsiPbPb2760c9; + } else if (sname == "PbPb 2.76c10") { + func = PtJpsiPbPb2760c10; + } else if (sname == "PbPb 2.76c11") { + func = PtJpsiPbPb2760c11; + } else if (sname == "pPb 5.03") { + func = PtJpsiPPb5030; + } else if (sname == "pPb 5.03c1") { + func = PtJpsiPPb5030c1; + } else if (sname == "pPb 5.03c2") { + func = PtJpsiPPb5030c2; + } else if (sname == "pPb 5.03c3") { + func = PtJpsiPPb5030c3; + } else if (sname == "pPb 5.03c4") { + func = PtJpsiPPb5030c4; + } else if (sname == "Pbp 5.03") { + func = PtJpsiPbP5030; + } else if (sname == "Pbp 5.03c1") { + func = PtJpsiPbP5030c1; + } else if (sname == "Pbp 5.03c2") { + func = PtJpsiPbP5030c2; + } else if (sname == "Pbp 5.03c3") { + func = PtJpsiPbP5030c3; + } else if (sname == "Pbp 5.03c4") { + func = PtJpsiPbP5030c4; + } else if (sname == "pPb 8.8") { + func = PtJpsiPPb8800; + } else if (sname == "pPb 8.8c1") { + func = PtJpsiPPb8800c1; + } else if (sname == "pPb 8.8c2") { + func = PtJpsiPPb8800c2; + } else if (sname == "pPb 8.8c3") { + func = PtJpsiPPb8800c3; + } else if (sname == "pPb 8.8c4") { + func = PtJpsiPPb8800c4; + } else if (sname == "Pbp 8.8") { + func = PtJpsiPbP8800; + } else if (sname == "Pbp 8.8c1") { + func = PtJpsiPbP8800c1; + } else if (sname == "Pbp 8.8c2") { + func = PtJpsiPbP8800c2; + } else if (sname == "Pbp 8.8c3") { + func = PtJpsiPbP8800c3; + } else if (sname == "Pbp 8.8c4") { + func = PtJpsiPbP8800c4; + } else if (sname == "CDF scaled") { + func = PtJpsiCDFscaled; + } else if (sname == "CDF pp") { + func = PtJpsiCDFscaledPP; + } else if (sname == "CDF pp 10") { + func = PtJpsiCDFscaledPP10; + } else if (sname == "CDF pp 8.8") { + func = PtJpsiCDFscaledPP9; + } else if (sname == "CDF pp 7" || sname == "CDF pp 7 flat y") { + func = PtJpsiCDFscaledPP7; + } else if (sname == "CDF pp 3.94") { + func = PtJpsiCDFscaledPP4; + } else if (sname == "CDF pp 2.76") { + func = PtJpsiCDFscaledPP3; + } else if (sname == "CDF pp 1.9") { + func = PtJpsiCDFscaledPP2; + } else if (sname == "CDF pPb 8.8") { + func = PtJpsiCDFscaledPPb9; + } else if (sname == "CDF Pbp 8.8") { + func = PtJpsiCDFscaledPbP9; + } else if (sname == "CDF PbPb 3.94") { + func = PtJpsiCDFscaledPbPb4; + } else if (sname == "Flat" || sname == "CDF pp 7 flat pt") { + func = PtJpsiFlat; + } else { + func = PtJpsi; + } + break; + case kJpsiFromB: + func = PtJpsiBPbPb; + break; + case kUpsilonFamily: + case kUpsilonP: + case kUpsilonPP: + case kUpsilon: + if (sname == "Vogt" || sname == "Vogt PbPb") { + func = PtUpsilonPbPb; + } else if (sname == "Vogt pp") { + func = PtUpsilonPP; + } else if (sname == "pp 7") { + func = PtUpsilonPP7000; + } else if (sname == "pp 8") { + func = PtUpsilonPP8000; + } else if (sname == "pp 2.76") { + func = PtUpsilonPP2760; + } else if (sname == "pp 4.4") { + func = PtUpsilonPP4400; + } else if (sname == "pp 5.03") { + func = PtUpsilonPP5030; + } else if (sname == "pp 8.8") { + func = PtUpsilonPP8800; + } else if (sname == "pp 7 poly") { + func = PtUpsilonPP7000; + } else if (sname == "pp 2.76 poly") { + func = PtUpsilonPP2760; + } else if (sname == "PbPb 2.76") { + func = PtUpsilonPbPb2760; + } else if (sname == "PbPb 2.76c1") { + func = PtUpsilonPbPb2760c1; + } else if (sname == "PbPb 2.76c2") { + func = PtUpsilonPbPb2760c2; + } else if (sname == "PbPb 2.76c3") { + func = PtUpsilonPbPb2760c3; + } else if (sname == "PbPb 2.76c4") { + func = PtUpsilonPbPb2760c4; + } else if (sname == "PbPb 2.76c5") { + func = PtUpsilonPbPb2760c5; + } else if (sname == "PbPb 2.76c6") { + func = PtUpsilonPbPb2760c6; + } else if (sname == "PbPb 2.76c7") { + func = PtUpsilonPbPb2760c7; + } else if (sname == "PbPb 2.76c8") { + func = PtUpsilonPbPb2760c8; + } else if (sname == "PbPb 2.76c9") { + func = PtUpsilonPbPb2760c9; + } else if (sname == "PbPb 2.76c10") { + func = PtUpsilonPbPb2760c10; + } else if (sname == "PbPb 2.76c11") { + func = PtUpsilonPbPb2760c11; + } else if (sname == "pPb 5.03") { + func = PtUpsilonPPb5030; + } else if (sname == "pPb 5.03c1") { + func = PtUpsilonPPb5030c1; + } else if (sname == "pPb 5.03c2") { + func = PtUpsilonPPb5030c2; + } else if (sname == "pPb 5.03c3") { + func = PtUpsilonPPb5030c3; + } else if (sname == "pPb 5.03c4") { + func = PtUpsilonPPb5030c4; + } else if (sname == "Pbp 5.03") { + func = PtUpsilonPbP5030; + } else if (sname == "Pbp 5.03c1") { + func = PtUpsilonPbP5030c1; + } else if (sname == "Pbp 5.03c2") { + func = PtUpsilonPbP5030c2; + } else if (sname == "Pbp 5.03c3") { + func = PtUpsilonPbP5030c3; + } else if (sname == "Pbp 5.03c4") { + func = PtUpsilonPbP5030c4; + } else if (sname == "pPb 8.8") { + func = PtUpsilonPPb8800; + } else if (sname == "pPb 8.8c1") { + func = PtUpsilonPPb8800c1; + } else if (sname == "pPb 8.8c2") { + func = PtUpsilonPPb8800c2; + } else if (sname == "pPb 8.8c3") { + func = PtUpsilonPPb8800c3; + } else if (sname == "pPb 8.8c4") { + func = PtUpsilonPPb8800c4; + } else if (sname == "Pbp 8.8") { + func = PtUpsilonPbP8800; + } else if (sname == "Pbp 8.8c1") { + func = PtUpsilonPbP8800c1; + } else if (sname == "Pbp 8.8c2") { + func = PtUpsilonPbP8800c2; + } else if (sname == "Pbp 8.8c3") { + func = PtUpsilonPbP8800c3; + } else if (sname == "Pbp 8.8c4") { + func = PtUpsilonPbP8800c4; + } else if (sname == "CDF scaled") { + func = PtUpsilonCDFscaled; + } else if (sname == "CDF pp") { + func = PtUpsilonCDFscaledPP; + } else if (sname == "CDF pp 10") { + func = PtUpsilonCDFscaledPP10; + } else if (sname == "CDF pp 8.8") { + func = PtUpsilonCDFscaledPP9; + } else if (sname == "CDF pp 7") { + func = PtUpsilonCDFscaledPP7; + } else if (sname == "CDF pp 3.94") { + func = PtUpsilonCDFscaledPP4; + } else if (sname == "CDF pPb 8.8") { + func = PtUpsilonCDFscaledPPb9; + } else if (sname == "CDF Pbp 8.8") { + func = PtUpsilonCDFscaledPbP9; + } else if (sname == "CDF PbPb 3.94") { + func = PtUpsilonCDFscaledPbPb4; + } else if (sname == "Flat") { + func = PtUpsilonFlat; + } else { + func = PtUpsilon; + } + break; + case kCharm: + if (sname == "F0M0S0 pp") { + func = PtCharmF0M0S0PP; + } else if (sname == "F1M0S0 pp") { + func = PtCharmF1M0S0PP; + } else if (sname == "F2M0S0 pp") { + func = PtCharmF2M0S0PP; + } else if (sname == "F0M1S0 pp") { + func = PtCharmF0M1S0PP; + } else if (sname == "F0M2S0 pp") { + func = PtCharmF0M2S0PP; + } else if (sname == "F0M0S1 pp") { + func = PtCharmF0M0S1PP; + } else if (sname == "F0M0S2 pp") { + func = PtCharmF0M0S2PP; + } else if (sname == "F0M0S3 pp") { + func = PtCharmF0M0S3PP; + } else if (sname == "F0M0S4 pp") { + func = PtCharmF0M0S4PP; + } else if (sname == "F0M0S5 pp") { + func = PtCharmF0M0S5PP; + } else if (sname == "F0M0S6 pp") { + func = PtCharmF0M0S6PP; + } else if (sname == "central") { + func = PtCharmCentral; + } else { + func = PtCharm; + } + break; + case kBeauty: + if (sname == "F0M0S0 pp") { + func = PtBeautyF0M0S0PP; + } else if (sname == "F1M0S0 pp") { + func = PtBeautyF1M0S0PP; + } else if (sname == "F2M0S0 pp") { + func = PtBeautyF2M0S0PP; + } else if (sname == "F0M1S0 pp") { + func = PtBeautyF0M1S0PP; + } else if (sname == "F0M2S0 pp") { + func = PtBeautyF0M2S0PP; + } else if (sname == "F0M0S1 pp") { + func = PtBeautyF0M0S1PP; + } else if (sname == "F0M0S2 pp") { + func = PtBeautyF0M0S2PP; + } else if (sname == "F0M0S3 pp") { + func = PtBeautyF0M0S3PP; + } else if (sname == "F0M0S4 pp") { + func = PtBeautyF0M0S4PP; + } else if (sname == "F0M0S5 pp") { + func = PtBeautyF0M0S5PP; + } else if (sname == "F0M0S6 pp") { + func = PtBeautyF0M0S6PP; + } else if (sname == "central") { + func = PtBeautyCentral; + } else { + func = PtBeauty; + } + break; + case kPion: + if (sname == "2010 Pos PP") { + func = PtPionPos2010PP; + } else if (sname == "2010 Neg PP") { + func = PtPionNeg2010PP; + } else { + func = PtPion; + } + break; + case kKaon: + if (sname == "2010 Pos PP") { + func = PtKaonPos2010PP; + } else if (sname == "2010 Neg PP") { + func = PtKaonNeg2010PP; + } else { + func = PtKaon; + } + break; + case kChic0: + func = PtChic0; + break; + case kChic: + func = PtChic; + break; + case kRho: + func = PtRho; + break; + default: + func = 0; + printf(" unknown parametrisation\n"); + } + return func; +} + +GenFunc GeneratorParamMUONlib::GetY(Int_t param, const char *tname) const { + // + // Return pointer to y- parameterisation + // + TString sname = TString(tname); + GenFunc func; + switch (param) { + case kPhi: + func = YPhi; + break; + case kEta: + func = YEta; + break; + case kOmega: + func = YOmega; + break; + case kJpsiFamily: + case kPsiP: + case kChic1: + case kChic2: + case kJpsi: + if (sname == "Vogt" || sname == "Vogt PbPb") { + func = YJpsiPbPb; + } else if (sname == "Vogt pp") { + func = YJpsiPP; + } else if (sname == "pp 7") { + func = YJpsiPP7000; + } else if (sname == "pp 8") { + func = YJpsiPP8000; + } else if (sname == "pp 2.76") { + func = YJpsiPP2760; + } else if (sname == "pp 4.4") { + func = YJpsiPP4400; + } else if (sname == "pp 5.03") { + func = YJpsiPP5030; + } else if (sname == "pp 8.8") { + func = YJpsiPP8800; + } else if (sname == "pp 7 poly") { + func = YJpsiPPpoly7000; + } else if (sname == "pp 2.76 poly") { + func = YJpsiPPpoly2760; + } else if (sname == "PbPb 2.76") { + func = YJpsiPbPb2760; + } else if (sname == "PbPb 2.76c1") { + func = YJpsiPbPb2760c1; + } else if (sname == "PbPb 2.76c2") { + func = YJpsiPbPb2760c2; + } else if (sname == "PbPb 2.76c3") { + func = YJpsiPbPb2760c3; + } else if (sname == "PbPb 2.76c4") { + func = YJpsiPbPb2760c4; + } else if (sname == "PbPb 2.76c5") { + func = YJpsiPbPb2760c5; + } else if (sname == "PbPb 2.76c6") { + func = YJpsiPbPb2760c6; + } else if (sname == "PbPb 2.76c7") { + func = YJpsiPbPb2760c7; + } else if (sname == "PbPb 2.76c8") { + func = YJpsiPbPb2760c8; + } else if (sname == "PbPb 2.76c9") { + func = YJpsiPbPb2760c9; + } else if (sname == "PbPb 2.76c10") { + func = YJpsiPbPb2760c10; + } else if (sname == "PbPb 2.76c11") { + func = YJpsiPbPb2760c11; + } else if (sname == "pPb 5.03") { + func = YJpsiPPb5030; + } else if (sname == "pPb 5.03c1") { + func = YJpsiPPb5030c1; + } else if (sname == "pPb 5.03c2") { + func = YJpsiPPb5030c2; + } else if (sname == "pPb 5.03c3") { + func = YJpsiPPb5030c3; + } else if (sname == "pPb 5.03c4") { + func = YJpsiPPb5030c4; + } else if (sname == "Pbp 5.03") { + func = YJpsiPbP5030; + } else if (sname == "Pbp 5.03c1") { + func = YJpsiPbP5030c1; + } else if (sname == "Pbp 5.03c2") { + func = YJpsiPbP5030c2; + } else if (sname == "Pbp 5.03c3") { + func = YJpsiPbP5030c3; + } else if (sname == "Pbp 5.03c4") { + func = YJpsiPbP5030c4; + } else if (sname == "pPb 8.8") { + func = YJpsiPPb8800; + } else if (sname == "pPb 8.8c1") { + func = YJpsiPPb8800c1; + } else if (sname == "pPb 8.8c2") { + func = YJpsiPPb8800c2; + } else if (sname == "pPb 8.8c3") { + func = YJpsiPPb8800c3; + } else if (sname == "pPb 8.8c4") { + func = YJpsiPPb8800c4; + } else if (sname == "Pbp 8.8") { + func = YJpsiPbP8800; + } else if (sname == "Pbp 8.8c1") { + func = YJpsiPbP8800c1; + } else if (sname == "Pbp 8.8c2") { + func = YJpsiPbP8800c2; + } else if (sname == "Pbp 8.8c3") { + func = YJpsiPbP8800c3; + } else if (sname == "Pbp 8.8c4") { + func = YJpsiPbP8800c4; + } else if (sname == "CDF scaled") { + func = YJpsiCDFscaled; + } else if (sname == "CDF pp") { + func = YJpsiCDFscaledPP; + } else if (sname == "CDF pp 10") { + func = YJpsiCDFscaledPP10; + } else if (sname == "CDF pp 8.8") { + func = YJpsiCDFscaledPP9; + } else if (sname == "CDF pp 7" || sname == "CDF pp 7 flat pt") { + func = YJpsiCDFscaledPP7; + } else if (sname == "CDF pp 3.94") { + func = YJpsiCDFscaledPP4; + } else if (sname == "CDF pp 2.76") { + func = YJpsiCDFscaledPP3; + } else if (sname == "CDF pp 1.9") { + func = YJpsiCDFscaledPP2; + } else if (sname == "CDF pPb 8.8") { + func = YJpsiCDFscaledPPb9; + } else if (sname == "CDF Pbp 8.8") { + func = YJpsiCDFscaledPbP9; + } else if (sname == "CDF PbPb 3.94") { + func = YJpsiCDFscaledPbPb4; + } else if (sname == "Flat" || sname == "CDF pp 7 flat y") { + func = YJpsiFlat; + } else { + func = YJpsi; + } + break; + case kJpsiFromB: + func = YJpsiBPbPb; + break; + case kUpsilonFamily: + case kUpsilonP: + case kUpsilonPP: + case kUpsilon: + if (sname == "Vogt" || sname == "Vogt PbPb") { + func = YUpsilonPbPb; + } else if (sname == "Vogt pp") { + func = YUpsilonPP; + } else if (sname == "pp 7") { + func = YUpsilonPP7000; + } else if (sname == "pp 8") { + func = YUpsilonPP8000; + } else if (sname == "pp 2.76") { + func = YUpsilonPP2760; + } else if (sname == "pp 4.4") { + func = YUpsilonPP4400; + } else if (sname == "pp 5.03") { + func = YUpsilonPP5030; + } else if (sname == "pp 8.8") { + func = YUpsilonPP8800; + } else if (sname == "pp 7 poly") { + func = YUpsilonPPpoly7000; + } else if (sname == "pp 2.76 poly") { + func = YUpsilonPPpoly2760; + } else if (sname == "PbPb 2.76") { + func = YUpsilonPbPb2760; + } else if (sname == "PbPb 2.76c1") { + func = YUpsilonPbPb2760c1; + } else if (sname == "PbPb 2.76c2") { + func = YUpsilonPbPb2760c2; + } else if (sname == "PbPb 2.76c3") { + func = YUpsilonPbPb2760c3; + } else if (sname == "PbPb 2.76c4") { + func = YUpsilonPbPb2760c4; + } else if (sname == "PbPb 2.76c5") { + func = YUpsilonPbPb2760c5; + } else if (sname == "PbPb 2.76c6") { + func = YUpsilonPbPb2760c6; + } else if (sname == "PbPb 2.76c7") { + func = YUpsilonPbPb2760c7; + } else if (sname == "PbPb 2.76c8") { + func = YUpsilonPbPb2760c8; + } else if (sname == "PbPb 2.76c9") { + func = YUpsilonPbPb2760c9; + } else if (sname == "PbPb 2.76c10") { + func = YUpsilonPbPb2760c10; + } else if (sname == "PbPb 2.76c11") { + func = YUpsilonPbPb2760c11; + } else if (sname == "pPb 5.03") { + func = YUpsilonPPb5030; + } else if (sname == "pPb 5.03c1") { + func = YUpsilonPPb5030c1; + } else if (sname == "pPb 5.03c2") { + func = YUpsilonPPb5030c2; + } else if (sname == "pPb 5.03c3") { + func = YUpsilonPPb5030c3; + } else if (sname == "pPb 5.03c4") { + func = YUpsilonPPb5030c4; + } else if (sname == "Pbp 5.03") { + func = YUpsilonPbP5030; + } else if (sname == "Pbp 5.03c1") { + func = YUpsilonPbP5030c1; + } else if (sname == "Pbp 5.03c2") { + func = YUpsilonPbP5030c2; + } else if (sname == "Pbp 5.03c3") { + func = YUpsilonPbP5030c3; + } else if (sname == "Pbp 5.03c4") { + func = YUpsilonPbP5030c4; + } else if (sname == "pPb 8.8") { + func = YUpsilonPPb8800; + } else if (sname == "pPb 8.8c1") { + func = YUpsilonPPb8800c1; + } else if (sname == "pPb 8.8c2") { + func = YUpsilonPPb8800c2; + } else if (sname == "pPb 8.8c3") { + func = YUpsilonPPb8800c3; + } else if (sname == "pPb 8.8c4") { + func = YUpsilonPPb8800c4; + } else if (sname == "Pbp 8.8") { + func = YUpsilonPbP8800; + } else if (sname == "Pbp 8.8c1") { + func = YUpsilonPbP8800c1; + } else if (sname == "Pbp 8.8c2") { + func = YUpsilonPbP8800c2; + } else if (sname == "Pbp 8.8c3") { + func = YUpsilonPbP8800c3; + } else if (sname == "Pbp 8.8c4") { + func = YUpsilonPbP8800c4; + } else if (sname == "CDF scaled") { + func = YUpsilonCDFscaled; + } else if (sname == "CDF pp") { + func = YUpsilonCDFscaledPP; + } else if (sname == "CDF pp 10") { + func = YUpsilonCDFscaledPP10; + } else if (sname == "CDF pp 8.8") { + func = YUpsilonCDFscaledPP9; + } else if (sname == "CDF pp 7") { + func = YUpsilonCDFscaledPP7; + } else if (sname == "CDF pp 3.94") { + func = YUpsilonCDFscaledPP4; + } else if (sname == "CDF pPb 8.8") { + func = YUpsilonCDFscaledPPb9; + } else if (sname == "CDF Pbp 8.8") { + func = YUpsilonCDFscaledPbP9; + } else if (sname == "CDF PbPb 3.94") { + func = YUpsilonCDFscaledPbPb4; + } else if (sname == "Flat") { + func = YUpsilonFlat; + } else { + func = YUpsilon; + } + break; + case kCharm: + if (sname == "F0M0S0 pp") { + func = YCharmF0M0S0PP; + } else if (sname == "F1M0S0 pp") { + func = YCharmF1M0S0PP; + } else if (sname == "F2M0S0 pp") { + func = YCharmF2M0S0PP; + } else if (sname == "F0M1S0 pp") { + func = YCharmF0M1S0PP; + } else if (sname == "F0M2S0 pp") { + func = YCharmF0M2S0PP; + } else if (sname == "F0M0S1 pp") { + func = YCharmF0M0S1PP; + } else if (sname == "F0M0S2 pp") { + func = YCharmF0M0S2PP; + } else if (sname == "F0M0S3 pp") { + func = YCharmF0M0S3PP; + } else if (sname == "F0M0S4 pp") { + func = YCharmF0M0S4PP; + } else if (sname == "F0M0S5 pp") { + func = YCharmF0M0S5PP; + } else if (sname == "F0M0S6 pp") { + func = YCharmF0M0S6PP; + } else { + func = YCharm; + } + break; + case kBeauty: + if (sname == "F0M0S0 pp") { + func = YBeautyF0M0S0PP; + } else if (sname == "F1M0S0 pp") { + func = YBeautyF1M0S0PP; + } else if (sname == "F2M0S0 pp") { + func = YBeautyF2M0S0PP; + } else if (sname == "F0M1S0 pp") { + func = YBeautyF0M1S0PP; + } else if (sname == "F0M2S0 pp") { + func = YBeautyF0M2S0PP; + } else if (sname == "F0M0S1 pp") { + func = YBeautyF0M0S1PP; + } else if (sname == "F0M0S2 pp") { + func = YBeautyF0M0S2PP; + } else if (sname == "F0M0S3 pp") { + func = YBeautyF0M0S3PP; + } else if (sname == "F0M0S4 pp") { + func = YBeautyF0M0S4PP; + } else if (sname == "F0M0S5 pp") { + func = YBeautyF0M0S5PP; + } else if (sname == "F0M0S6 pp") { + func = YBeautyF0M0S6PP; + } else { + func = YBeauty; + } + break; + case kPion: + if (sname == "2010 Pos PP") { + func = YKaonPion2010PP; + } else if (sname == "2010 Neg PP") { + func = YKaonPion2010PP; + } else { + func = YPion; + } + break; + case kKaon: + if (sname == "2010 Pos PP") { + func = YKaonPion2010PP; + } else if (sname == "2010 Neg PP") { + func = YKaonPion2010PP; + } else { + func = YKaon; + } + break; + case kChic0: + func = YChic0; + break; + case kChic: + func = YChic; + break; + case kRho: + func = YRho; + break; + default: + func = 0; + printf(" unknown parametrisation\n"); + } + return func; +} + +// +// Chi +// +// +// pt-distribution +//____________________________________________________________ +Double_t GeneratorParamMUONlib::PtChic0(const Double_t *px, + const Double_t * /*dummy*/) { + // Chi_c1 pT + const Double_t kpt0 = 4.; + const Double_t kxn = 3.6; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtChic1(const Double_t *px, + const Double_t * /*dummy*/) { + // Chi_c1 pT + const Double_t kpt0 = 4.; + const Double_t kxn = 3.6; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtChic2(const Double_t *px, + const Double_t * /*dummy*/) { + // Chi_c2 pT + const Double_t kpt0 = 4.; + const Double_t kxn = 3.6; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} +Double_t GeneratorParamMUONlib::PtChic(const Double_t *px, + const Double_t * /*dummy*/) { + // Chi_c family pT + const Double_t kpt0 = 4.; + const Double_t kxn = 3.6; + Double_t x = *px; + // + Double_t pass1 = 1. + (x / kpt0) * (x / kpt0); + return x / TMath::Power(pass1, kxn); +} + +// +// y-distribution +//____________________________________________________________ +Double_t GeneratorParamMUONlib::YChic0(const Double_t *py, + const Double_t * /*dummy*/) { + // Chi-1c y + const Double_t ky0 = 4.; + const Double_t kb = 1.; + Double_t yj; + Double_t y = TMath::Abs(*py); + // + if (y < ky0) + yj = kb; + else + yj = kb * TMath::Exp(-(y - ky0) * (y - ky0) / 2); + return yj; +} + +Double_t GeneratorParamMUONlib::YChic1(const Double_t *py, + const Double_t * /*dummy*/) { + // Chi-1c y + const Double_t ky0 = 4.; + const Double_t kb = 1.; + Double_t yj; + Double_t y = TMath::Abs(*py); + // + if (y < ky0) + yj = kb; + else + yj = kb * TMath::Exp(-(y - ky0) * (y - ky0) / 2); + return yj; +} + +Double_t GeneratorParamMUONlib::YChic2(const Double_t *py, + const Double_t * /*dummy*/) { + // Chi-2c y + const Double_t ky0 = 4.; + const Double_t kb = 1.; + Double_t yj; + Double_t y = TMath::Abs(*py); + // + if (y < ky0) + yj = kb; + else + yj = kb * TMath::Exp(-(y - ky0) * (y - ky0) / 2); + return yj; +} + +Double_t GeneratorParamMUONlib::YChic(const Double_t *py, + const Double_t * /*dummy*/) { + // Chi_c family y + const Double_t ky0 = 4.; + const Double_t kb = 1.; + Double_t yj; + Double_t y = TMath::Abs(*py); + // + if (y < ky0) + yj = kb; + else + yj = kb * TMath::Exp(-(y - ky0) * (y - ky0) / 2); + return yj; +} + +// particle composition +// +Int_t GeneratorParamMUONlib::IpChic0(TRandom *) { + // Chi composition + return 10441; +} +// +Int_t GeneratorParamMUONlib::IpChic1(TRandom *) { + // Chi composition + return 20443; +} +Int_t GeneratorParamMUONlib::IpChic2(TRandom *) { + // Chi_c2 prime composition + return 445; +} +Int_t GeneratorParamMUONlib::IpChic(TRandom *) { + // Chi composition + Int_t ip; + Float_t r = gRandom->Rndm(); + if (r < 0.001) { + ip = 10441; + } else if (r < 0.377) { + ip = 20443; + } else { + ip = 445; + } + return ip; +} + +//_____________________________________________________________ + +typedef Int_t (*GenFuncIp)(TRandom *); +GenFuncIp GeneratorParamMUONlib::GetIp(Int_t param, const char *tname) const { + // Return pointer to particle type parameterisation + TString sname = TString(tname); + GenFuncIp func; + switch (param) { + case kPhi: + func = IpPhi; + break; + case kEta: + func = IpEta; + break; + case kOmega: + func = IpOmega; + break; + case kJpsiFamily: + func = IpJpsiFamily; + break; + case kPsiP: + func = IpPsiP; + break; + case kJpsi: + case kJpsiFromB: + func = IpJpsi; + break; + case kUpsilon: + func = IpUpsilon; + break; + case kUpsilonFamily: + func = IpUpsilonFamily; + break; + case kUpsilonP: + func = IpUpsilonP; + break; + case kUpsilonPP: + func = IpUpsilonPP; + break; + case kCharm: + func = IpCharm; + break; + case kBeauty: + func = IpBeauty; + break; + case kPion: + if (sname == "2010 Pos PP") { + func = IpPionPos; + } else if (sname == "2010 Neg PP") { + func = IpPionNeg; + } else { + func = IpPion; + } + break; + case kKaon: + if (sname == "2010 Pos PP") { + func = IpKaonPos; + } else if (sname == "2010 Neg PP") { + func = IpKaonNeg; + } else { + func = IpKaon; + } + break; + case kChic0: + func = IpChic0; + break; + case kChic1: + func = IpChic1; + break; + case kChic2: + func = IpChic2; + break; + case kChic: + func = IpChic; + break; + case kRho: + func = IpRho; + break; + default: + func = 0; + printf(" unknown parametrisation\n"); + } + return func; +} + +Float_t GeneratorParamMUONlib::Interpolate(Float_t x, Float_t *y, Float_t x0, + Float_t dx, Int_t n, Int_t no) { + // + // Neville's alorithm for interpolation + // + // x: x-value + // y: Input array + // x0: minimum x + // dx: step size + // n: number of data points + // no: order of polynom + // + Float_t *c = new Float_t[n]; + Float_t *d = new Float_t[n]; + Int_t m, i; + for (i = 0; i < n; i++) { + c[i] = y[i]; + d[i] = y[i]; + } + + Int_t ns = int((x - x0) / dx); + + Float_t y1 = y[ns]; + ns--; + for (m = 0; m < no; m++) { + for (i = 0; i < n - m; i++) { + Float_t ho = x0 + Float_t(i) * dx - x; + Float_t hp = x0 + Float_t(i + m + 1) * dx - x; + Float_t w = c[i + 1] - d[i]; + Float_t den = ho - hp; + den = w / den; + d[i] = hp * den; + c[i] = ho * den; + } + Float_t dy; + + if (2 * ns < (n - m - 1)) { + dy = c[ns + 1]; + } else { + dy = d[ns--]; + } + y1 += dy; + } + delete[] c; + delete[] d; + + return y1; +} + +//============================================================================= +Double_t GeneratorParamMUONlib::PtPionPos2010PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Pos pion + const Double_t par[3] = {2.27501, 0.116141, 5.59591}; + Double_t pt = px[0]; + Double_t m0 = TDatabasePDG::Instance()->GetParticle(211)->Mass(); + Double_t mt = TMath::Sqrt(m0 * m0 + pt * pt); + Double_t nc = par[1] * par[2]; + Double_t t1 = (par[2] - 1.) / nc / (nc / (par[2] - 2.) + m0); + Double_t t2 = TMath::Power(1. + (mt - m0) / nc, -1. * par[2]); + Double_t fn = par[0] * pt * t1 * t2; + return fn; +} + +//============================================================================= +Double_t GeneratorParamMUONlib::PtPionNeg2010PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Neg pion + const Double_t par[3] = {2.25188, 0.12176, 5.91166}; + Double_t pt = px[0]; + Double_t m0 = TDatabasePDG::Instance()->GetParticle(211)->Mass(); + Double_t mt = TMath::Sqrt(m0 * m0 + pt * pt); + Double_t nc = par[1] * par[2]; + Double_t t1 = (par[2] - 1.) / nc / (nc / (par[2] - 2.) + m0); + Double_t t2 = TMath::Power(1. + (mt - m0) / nc, -1. * par[2]); + Double_t fn = par[0] * pt * t1 * t2; + return fn; +} + +//============================================================================= +Double_t GeneratorParamMUONlib::PtKaonPos2010PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Pos kaons + const Double_t par[3] = {0.279386, 0.195466, 6.59587}; + Double_t pt = px[0]; + Double_t m0 = TDatabasePDG::Instance()->GetParticle(321)->Mass(); + Double_t mt = TMath::Sqrt(m0 * m0 + pt * pt); + Double_t nc = par[1] * par[2]; + Double_t t1 = (par[2] - 1.) / nc / (nc / (par[2] - 2.) + m0); + Double_t t2 = TMath::Power(1. + (mt - m0) / nc, -1. * par[2]); + Double_t fn = par[0] * pt * t1 * t2; + return fn; +} + +//============================================================================= +Double_t GeneratorParamMUONlib::PtKaonNeg2010PP(const Double_t *px, + const Double_t * /*dummy*/) { + // Neg kaons + const Double_t par[3] = {0.278927, 0.189049, 6.43006}; + Double_t pt = px[0]; + Double_t m0 = TDatabasePDG::Instance()->GetParticle(321)->Mass(); + Double_t mt = TMath::Sqrt(m0 * m0 + pt * pt); + Double_t nc = par[1] * par[2]; + Double_t t1 = (par[2] - 1.) / nc / (nc / (par[2] - 2.) + m0); + Double_t t2 = TMath::Power(1. + (mt - m0) / nc, -1. * par[2]); + Double_t fn = par[0] * pt * t1 * t2; + return fn; +} + +//============================================================================= +Double_t GeneratorParamMUONlib::YKaonPion2010PP(const Double_t *px, + const Double_t * /*dummy*/) { + // pions and kaons + Double_t y = px[0]; + Double_t sigma = 2.35; + Double_t kernal = y / 2. / sigma; + Double_t fxn = TMath::Exp(-1. * kernal * kernal); + return fxn; +} + +//============================================================================= +Int_t GeneratorParamMUONlib::IpPionPos(TRandom *) { + // Pos pions + return 211; +} + +//============================================================================= +Int_t GeneratorParamMUONlib::IpPionNeg(TRandom *) { + // Neg pions + return -211; +} + +//============================================================================= +Int_t GeneratorParamMUONlib::IpKaonPos(TRandom *) { + // pos Kaons + return 321; +} + +//============================================================================= +Int_t GeneratorParamMUONlib::IpKaonNeg(TRandom *) { + // neg Kaons + return -321; +} diff --git a/GeneratorParam/GeneratorParamMUONlib.h b/GeneratorParam/GeneratorParamMUONlib.h new file mode 100644 index 0000000..96fe2b4 --- /dev/null +++ b/GeneratorParam/GeneratorParamMUONlib.h @@ -0,0 +1,442 @@ +#ifndef GENERATORPARAMMUONLIB_H +#define GENERATORPARAMMUONLIB_H +#include "GeneratorParamLibBase.h" + +class GeneratorParamMUONlib : public GeneratorParamLibBase { +public: + enum constants { + kPhi, + kOmega, + kEta, + kJpsi, + kJpsiFamily, + kPsiP, + kJpsiFromB, + kUpsilon, + kUpsilonFamily, + kUpsilonP, + kUpsilonPP, + kCharm, + kBeauty, + kPion, + kKaon, + kChic, + kChic0, + kChic1, + kChic2, + kRho + }; + + GenFunc GetPt(Int_t param, const char *tname = 0) const; + GenFunc GetY(Int_t param, const char *tname = 0) const; + GenFuncIp GetIp(Int_t param, const char *tname = 0) const; + +private: + // pions + static Double_t PtPion(const Double_t *px, const Double_t *dummy); + static Double_t PtScal(Double_t pt, Int_t np); + static Double_t YPion(const Double_t *py, const Double_t *dummy); + static Int_t IpPion(TRandom *ran); + // kaons + static Double_t PtKaon(const Double_t *px, const Double_t *dummy); + static Double_t YKaon(const Double_t *py, const Double_t *dummy); + static Int_t IpKaon(TRandom *ran); + // XZhang 20110621 + static Double_t PtPionPos2010PP(const Double_t *px, const Double_t *dummy); + static Double_t PtPionNeg2010PP(const Double_t *px, const Double_t *dummy); + static Double_t PtKaonPos2010PP(const Double_t *px, const Double_t *dummy); + static Double_t PtKaonNeg2010PP(const Double_t *px, const Double_t *dummy); + static Double_t YKaonPion2010PP(const Double_t *px, const Double_t *dummy); + static Int_t IpPionPos(TRandom *ran); + static Int_t IpPionNeg(TRandom *ran); + static Int_t IpKaonPos(TRandom *ran); + static Int_t IpKaonNeg(TRandom *ran); + // Phi + static Double_t PtPhi(const Double_t *px, const Double_t *dummy); + static Double_t YPhi(const Double_t *px, const Double_t *dummy); + static Int_t IpPhi(TRandom *ran); + // Omega + static Double_t PtOmega(const Double_t *px, const Double_t *dummy); + static Double_t YOmega(const Double_t *px, const Double_t *dummy); + static Int_t IpOmega(TRandom *ran); + // Eta + static Double_t PtEta(const Double_t *px, const Double_t *dummy); + static Double_t YEta(const Double_t *px, const Double_t *dummy); + static Int_t IpEta(TRandom *ran); + // Rho + static Double_t PtRho(const Double_t *px, const Double_t *dummy); + static Double_t YRho(const Double_t *px, const Double_t *dummy); + static Int_t IpRho(TRandom *ran); + + // J/Psi + static Double_t PtJpsiPPdummy(Double_t px, Double_t en); + static Double_t PtJpsiPP7000(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPP8000(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPP2760(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPP4400(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPP5030(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPP8800(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760ShFdummy(Double_t px, Int_t n); + static Double_t PtJpsiPbPb2760(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c1(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c2(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c3(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c4(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c5(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c6(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c7(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c8(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c9(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c10(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbPb2760c11(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb5030ShFdummy(Double_t px, Int_t n); + static Double_t PtJpsiPPb5030(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb5030c1(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb5030c2(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb5030c3(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb5030c4(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP5030ShFdummy(Double_t px, Int_t n); + static Double_t PtJpsiPbP5030(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP5030c1(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP5030c2(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP5030c3(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP5030c4(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb8800ShFdummy(Double_t px, Int_t n); + static Double_t PtJpsiPPb8800(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb8800c1(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb8800c2(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb8800c3(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPPb8800c4(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP8800ShFdummy(Double_t px, Int_t n); + static Double_t PtJpsiPbP8800(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP8800c1(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP8800c2(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP8800c3(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiPbP8800c4(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsi(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiCDFscaled(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiCDFscaledPP(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiCDFscaledPP10(const Double_t *px, + const Double_t *dummy); + static Double_t PtJpsiCDFscaledPP9(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiCDFscaledPP7(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiCDFscaledPP4(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiCDFscaledPP3(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiCDFscaledPP2(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiCDFscaledPPb9(const Double_t *px, + const Double_t *dummy); + static Double_t PtJpsiCDFscaledPbP9(const Double_t *px, + const Double_t *dummy); + static Double_t PtJpsiCDFscaledPbPb4(const Double_t *px, + const Double_t *dummy); + static Double_t YJpsi(const Double_t *py, const Double_t *dummy); + static Double_t PtJpsiPbPb(const Double_t *px, const Double_t *dummy); + static Double_t PtJpsiBPbPb(const Double_t *px, const Double_t *dummy); + + static Double_t YJpsiPPdummy(Double_t px, Double_t en); + static Double_t YJpsiPPpoly(Double_t px, Double_t en); + static Double_t YJpsiPP7000(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPP8000(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPP2760(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPpoly7000(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPpoly2760(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPP4400(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPP5030(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPP8800(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760ShFdummy(Double_t px, Int_t n); + static Double_t YJpsiPbPb2760(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c1(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c2(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c3(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c4(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c5(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c6(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c7(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c8(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c9(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c10(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb2760c11(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPP5030dummy(Double_t px); + static Double_t YJpsiPPb5030ShFdummy(Double_t px, Int_t n); + static Double_t YJpsiPPb5030(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPb5030c1(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPb5030c2(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPb5030c3(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPb5030c4(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP5030(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP5030c1(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP5030c2(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP5030c3(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP5030c4(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPP8800dummy(Double_t px); + static Double_t YJpsiPPb8800ShFdummy(Double_t px, Int_t n); + static Double_t YJpsiPPb8800(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPb8800c1(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPb8800c2(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPb8800c3(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPPb8800c4(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP8800(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP8800c1(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP8800c2(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP8800c3(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbP8800c4(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPbPb(const Double_t *py, const Double_t *dummy); + static Double_t YJpsiCDFscaled(const Double_t *py, const Double_t *dummy); + static Double_t YJpsiCDFscaledPP(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiCDFscaledPP10(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiCDFscaledPP9(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiCDFscaledPP9dummy(Double_t px); + static Double_t YJpsiCDFscaledPP7(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiCDFscaledPP4(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiCDFscaledPP3(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiCDFscaledPP2(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiCDFscaledPPb9(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiCDFscaledPbP9(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiCDFscaledPbPb4(const Double_t *px, + const Double_t *dummy); + static Double_t PtJpsiPP(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiPP(const Double_t *py, const Double_t *dummy); + static Double_t YJpsiBPbPb(const Double_t *py, const Double_t *dummy); + static Int_t IpJpsi(TRandom *ran); + static Int_t IpJpsiFamily(TRandom *ran); + static Int_t IpPsiP(TRandom *ran); + static Double_t PtJpsiFlat(const Double_t *px, const Double_t *dummy); + static Double_t YJpsiFlat(const Double_t *py, const Double_t *dummy); + + // Upsilon + static Double_t PtUpsilonPPdummy(Double_t px, Double_t en); + static Double_t PtUpsilonPP8000(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPP7000(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPP2760(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPP4400(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPP5030(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPP8800(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbPb2760ShFdummy(Double_t px, Int_t n); + static Double_t PtUpsilonPbPb2760(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c1(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c2(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c3(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c4(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c5(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c6(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c7(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c8(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c9(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c10(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb2760c11(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPPb5030ShFdummy(Double_t px, Int_t n); + static Double_t PtUpsilonPPb5030(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPPb5030c1(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPPb5030c2(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPPb5030c3(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPPb5030c4(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP5030ShFdummy(Double_t px, Int_t n); + static Double_t PtUpsilonPbP5030(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP5030c1(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP5030c2(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP5030c3(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP5030c4(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPPb8800ShFdummy(Double_t px, Int_t n); + static Double_t PtUpsilonPPb8800(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPPb8800c1(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPPb8800c2(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPPb8800c3(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPPb8800c4(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP8800ShFdummy(Double_t px, Int_t n); + static Double_t PtUpsilonPbP8800(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP8800c1(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP8800c2(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP8800c3(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonPbP8800c4(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilon(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonCDFscaled(const Double_t *px, const Double_t *dummy); + static Double_t PtUpsilonCDFscaledPP(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonCDFscaledPP10(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonCDFscaledPP9(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonCDFscaledPP7(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonCDFscaledPP4(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonCDFscaledPPb9(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonCDFscaledPbP9(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonCDFscaledPbPb4(const Double_t *px, + const Double_t *dummy); + + static Double_t YUpsilonPPdummy(Double_t px, Double_t en); + static Double_t YUpsilonPPpoly(Double_t px, Double_t en); + static Double_t YUpsilonPP7000(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPP8000(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPP2760(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPpoly7000(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPpoly2760(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPP4400(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPP5030(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPP8800(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760ShFdummy(Double_t px, Int_t n); + static Double_t YUpsilonPbPb2760(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c1(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c2(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c3(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c4(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c5(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c6(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c7(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c8(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c9(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb2760c10(const Double_t *px, + const Double_t *dummy); + static Double_t YUpsilonPbPb2760c11(const Double_t *px, + const Double_t *dummy); + static Double_t YUpsilonPP5030dummy(Double_t px); + static Double_t YUpsilonPPb5030ShFdummy(Double_t px, Int_t n); + static Double_t YUpsilonPPb5030(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPb5030c1(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPb5030c2(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPb5030c3(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPb5030c4(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP5030(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP5030c1(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP5030c2(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP5030c3(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP5030c4(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPP8800dummy(Double_t px); + static Double_t YUpsilonPPb8800ShFdummy(Double_t px, Int_t n); + static Double_t YUpsilonPPb8800(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPb8800c1(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPb8800c2(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPb8800c3(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPPb8800c4(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP8800(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP8800c1(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP8800c2(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP8800c3(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbP8800c4(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilon(const Double_t *py, const Double_t *dummy); + static Double_t YUpsilonCDFscaled(const Double_t *py, const Double_t *dummy); + static Double_t YUpsilonCDFscaledPP(const Double_t *px, + const Double_t *dummy); + static Double_t YUpsilonCDFscaledPP10(const Double_t *px, + const Double_t *dummy); + static Double_t YUpsilonCDFscaledPP9(const Double_t *px, + const Double_t *dummy); + static Double_t YUpsilonCDFscaledPP9dummy(Double_t px); + static Double_t YUpsilonCDFscaledPP7(const Double_t *px, + const Double_t *dummy); + static Double_t YUpsilonCDFscaledPP4(const Double_t *px, + const Double_t *dummy); + static Double_t YUpsilonCDFscaledPPb9(const Double_t *px, + const Double_t *dummy); + static Double_t YUpsilonCDFscaledPbP9(const Double_t *px, + const Double_t *dummy); + static Double_t YUpsilonCDFscaledPbPb4(const Double_t *px, + const Double_t *dummy); + static Double_t PtUpsilonPbPb(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPbPb(const Double_t *py, const Double_t *dummy); + static Double_t PtUpsilonPP(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonPP(const Double_t *py, const Double_t *dummy); + static Int_t IpUpsilon(TRandom *ran); + static Int_t IpUpsilonFamily(TRandom *ran); + static Int_t IpUpsilonP(TRandom *ran); + static Int_t IpUpsilonPP(TRandom *ran); + static Double_t PtUpsilonFlat(const Double_t *px, const Double_t *dummy); + static Double_t YUpsilonFlat(const Double_t *py, const Double_t *dummy); + // + // Charm + static Double_t PtCharm(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmCentral(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF0M0S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF1M0S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF2M0S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF0M1S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF0M2S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF0M0S1PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF0M0S2PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF0M0S3PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF0M0S4PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF0M0S5PP(const Double_t *px, const Double_t *dummy); + static Double_t PtCharmF0M0S6PP(const Double_t *px, const Double_t *dummy); + static Double_t YCharm(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF0M0S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF1M0S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF2M0S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF0M1S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF0M2S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF0M0S1PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF0M0S2PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF0M0S3PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF0M0S4PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF0M0S5PP(const Double_t *py, const Double_t *dummy); + static Double_t YCharmF0M0S6PP(const Double_t *py, const Double_t *dummy); + static Int_t IpCharm(TRandom *ran); + // + // Beauty + static Double_t PtBeauty(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF0M0S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF1M0S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF2M0S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF0M1S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF0M2S0PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF0M0S1PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF0M0S2PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF0M0S3PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF0M0S4PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF0M0S5PP(const Double_t *px, const Double_t *dummy); + static Double_t PtBeautyF0M0S6PP(const Double_t *px, const Double_t *dummy); + static Double_t YBeauty(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF0M0S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF1M0S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF2M0S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF0M1S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF0M2S0PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF0M0S1PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF0M0S2PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF0M0S3PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF0M0S4PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF0M0S5PP(const Double_t *py, const Double_t *dummy); + static Double_t YBeautyF0M0S6PP(const Double_t *py, const Double_t *dummy); + static Double_t PtBeautyCentral(const Double_t *px, const Double_t *dummy); + static Int_t IpBeauty(TRandom *ran); + // + + // Chi 1c 2c + static Double_t PtChic0(const Double_t *px, const Double_t *dummy); + static Double_t YChic0(const Double_t *py, const Double_t *dummy); + static Int_t IpChic0(TRandom *ran); + + static Double_t PtChic1(const Double_t *px, const Double_t *dummy); + static Double_t YChic1(const Double_t *py, const Double_t *dummy); + static Int_t IpChic1(TRandom *ran); + + static Double_t PtChic2(const Double_t *px, const Double_t *dummy); + static Double_t YChic2(const Double_t *py, const Double_t *dummy); + static Int_t IpChic2(TRandom *ran); + + static Double_t PtChic(const Double_t *px, const Double_t *dummy); + static Double_t YChic(const Double_t *py, const Double_t *dummy); + static Int_t IpChic(TRandom *ran); + + // + + static Float_t Interpolate(Float_t x, Float_t *y, Float_t x0, Float_t dx, + Int_t n, Int_t no); + + ClassDef(GeneratorParamMUONlib, + 1) // Library providing y and pT parameterisations +}; +#endif diff --git a/GeneratorParam/PythiaDecayerConfig.cxx b/GeneratorParam/PythiaDecayerConfig.cxx new file mode 100644 index 0000000..4890165 --- /dev/null +++ b/GeneratorParam/PythiaDecayerConfig.cxx @@ -0,0 +1,907 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// Class to generate particles from using paramtrized pT and y distributions. +// Distributions are obtained from pointer to object of type +// GeneratorParamLibBase. Decays are performed using Pythia. +// andreas.morsch@cern.ch + +// Helper class for the configuration of the Pythia6 decayer +// Allows to force decay channels. +// Author: andreas.morsch@cern.ch + +#include "PythiaDecayerConfig.h" +#include +#include +#include +#include +#include +#include + +ClassImp(PythiaDecayerConfig) + + PythiaDecayerConfig::PythiaDecayerConfig() + : TObject(), fDecay(kAll), fHeavyFlavour(kTRUE), fLongLived(kFALSE), + fPatchOmegaDalitz(0), fDecayerExodus(0), fPi0(1) { + // Default Constructor + for (Int_t i = 0; i < 501; i++) + fBraPart[i] = 1.; +} + +PythiaDecayerConfig::PythiaDecayerConfig(const PythiaDecayerConfig &decayer) + : fDecay(kAll), fHeavyFlavour(kTRUE), fLongLived(kFALSE), + fPatchOmegaDalitz(0), fDecayerExodus(0), fPi0(1) { + // Copy Constructor + decayer.Copy(*this); + for (Int_t i = 0; i < 501; i++) + fBraPart[i] = 0.; +} + +void PythiaDecayerConfig::Init(Decay_t decay) { + + // Switch on heavy flavor decays + fPythia = TPythia6::Instance(); + fDecay = decay; + Int_t kc, i, j; + Int_t heavy[14] = {411, 421, 431, 4122, 4132, 4232, 4332, + 511, 521, 531, 5122, 5132, 5232, 5332}; + for (j = 0; j < 14; j++) { + kc = fPythia->Pycomp(heavy[j]); + if (fDecay == kNoDecayHeavy) { + fPythia->SetMDCY(kc, 1, 0); + } else { + fPythia->SetMDCY(kc, 1, 1); + for (i = fPythia->GetMDCY(kc, 2); + i < fPythia->GetMDCY(kc, 2) + fPythia->GetMDCY(kc, 3); i++) { + fPythia->SetMDME(i, 1, 1); + } + } + } + + if (fPi0) + fPythia->SetMDCY(fPythia->Pycomp(111), 1, 1); + + Int_t isw = 0; + if (fLongLived) + isw = 1; + + fPythia->SetMDCY(fPythia->Pycomp(130), 1, isw); + fPythia->SetMDCY(fPythia->Pycomp(310), 1, isw); + fPythia->SetMDCY(fPythia->Pycomp(3122), 1, isw); + fPythia->SetMDCY(fPythia->Pycomp(3112), 1, isw); + fPythia->SetMDCY(fPythia->Pycomp(3222), 1, isw); + fPythia->SetMDCY(fPythia->Pycomp(3312), 1, isw); + fPythia->SetMDCY(fPythia->Pycomp(3322), 1, isw); + fPythia->SetMDCY(fPythia->Pycomp(3334), 1, isw); + + // .. Force decay channels + ForceDecay(); +} + +void PythiaDecayerConfig::SwitchOffParticle(Int_t kf) { + // switch off decay for particle "kf" + fPythia->SetMDCY(fPythia->Pycomp(kf), 1, 0); +} + +void PythiaDecayerConfig::ForceDecay() { + // Force a particle decay mode + // Switch heavy flavour production off if requested + if (!fHeavyFlavour) + SwitchOffHeavyFlavour(); + // + Decay_t decay = fDecay; + fPythia->SetMSTJ(21, 2); + + // + // select mode + Int_t products[2]; + Int_t mult[2]; + Int_t products1[3]; + Int_t mult1[3]; + + switch (decay) { + case kHardMuons: + products1[0] = 13; + products1[1] = 443; + products1[2] = 100443; + mult1[0] = 1; + mult1[1] = 1; + mult1[2] = 1; + ForceParticleDecay(511, products1, mult1, 3); + ForceParticleDecay(521, products1, mult1, 3); + ForceParticleDecay(531, products1, mult1, 3); + ForceParticleDecay(5122, products1, mult1, 3); + ForceParticleDecay(5132, products1, mult1, 3); + ForceParticleDecay(5232, products1, mult1, 3); + ForceParticleDecay(5332, products1, mult1, 3); + ForceParticleDecay(100443, 443, 1); // Psi' -> J/Psi X + ForceParticleDecay(443, 13, 2); // J/Psi -> mu+ mu- + ForceParticleDecay(411, 13, 1); // D+/- + ForceParticleDecay(421, 13, 1); // D0 + ForceParticleDecay(431, 13, 1); // D_s + ForceParticleDecay(4122, 13, 1); // Lambda_c + ForceParticleDecay(4132, 13, 1); // Xsi_c + ForceParticleDecay(4232, 13, 1); // Sigma_c + ForceParticleDecay(4332, 13, 1); // Omega_c + break; + case kChiToJpsiGammaToMuonMuon: + products[0] = 443; + products[1] = 22; + mult[0] = 1; + mult[1] = 1; + ForceParticleDecay(20443, products, mult, 2); // Chi_1c -> J/Psi Gamma + ForceParticleDecay(445, products, mult, 2); // Chi_2c -> J/Psi Gamma + ForceParticleDecay(443, 13, 2); // J/Psi -> mu+ mu- + break; + case kChiToJpsiGammaToElectronElectron: + products[0] = 443; + products[1] = 22; + mult[0] = 1; + mult[1] = 1; + ForceParticleDecay(20443, products, mult, 2); // Chi_1c -> J/Psi Gamma + ForceParticleDecay(445, products, mult, 2); // Chi_2c -> J/Psi Gamma + ForceParticleDecay(443, 11, 2); // J/Psi -> e+ e- + break; + + case kBSemiMuonic: + ForceParticleDecay(511, 13, 1); // B0 + ForceParticleDecay(521, 13, 1); // B+/- + ForceParticleDecay(531, 13, 1); // B_s + ForceParticleDecay(5122, 13, 1); // Lambda_b + ForceParticleDecay(5132, 13, 1); // Xsi_b + ForceParticleDecay(5232, 13, 1); // Sigma_b + ForceParticleDecay(5332, 13, 1); // Omega_b + break; + case kDSemiMuonic: + ForceParticleDecay(411, 13, 1); // D0 + ForceParticleDecay(421, 13, 1); // D+/- + ForceParticleDecay(431, 13, 1); // D_s + ForceParticleDecay(4122, 13, 1); // Lambda_c + ForceParticleDecay(4132, 13, 1); // Xsi_c + ForceParticleDecay(4232, 13, 1); // Sigma_c + ForceParticleDecay(4332, 13, 1); // Omega_c + break; + case kSemiMuonic: + ForceParticleDecay(411, 13, 1); // D+/- + ForceParticleDecay(421, 13, 1); // D0 + ForceParticleDecay(431, 13, 1); // D_s + ForceParticleDecay(4122, 13, 1); // Lambda_c + ForceParticleDecay(4132, 13, 1); // Xsi_c + ForceParticleDecay(4232, 13, 1); // Sigma_c + ForceParticleDecay(4332, 13, 1); // Omega_c + ForceParticleDecay(511, 13, 1); // B0 + ForceParticleDecay(521, 13, 1); // B+/- + ForceParticleDecay(531, 13, 1); // B_s + ForceParticleDecay(5122, 13, 1); // Lambda_b + ForceParticleDecay(5132, 13, 1); // Xsi_b + ForceParticleDecay(5232, 13, 1); // Sigma_b + ForceParticleDecay(5332, 13, 1); // Omega_b + break; + case kDiMuon: + ForceParticleDecay(113, 13, 2); // rho + ForceParticleDecay(221, 13, 2); // eta + ForceParticleDecay(223, 13, 2); // omega + ForceParticleDecay(333, 13, 2); // phi + ForceParticleDecay(443, 13, 2); // J/Psi + ForceParticleDecay(100443, 13, 2); // Psi' + ForceParticleDecay(553, 13, 2); // Upsilon + ForceParticleDecay(100553, 13, 2); // Upsilon' + ForceParticleDecay(200553, 13, 2); // Upsilon'' + break; + case kJpsiDiMuon: + ForceParticleDecay(443, 13, 2); // J/Psi + break; + case kBSemiElectronic: + ForceParticleDecay(511, 11, 1); // B0 + ForceParticleDecay(521, 11, 1); // B+/- + ForceParticleDecay(531, 11, 1); // B_s + ForceParticleDecay(5122, 11, 1); // Lambda_b + ForceParticleDecay(5132, 11, 1); // Xsi_b + ForceParticleDecay(5232, 11, 1); // Sigma_b + ForceParticleDecay(5332, 11, 1); // Omega_b + break; + case kSemiElectronic: + ForceParticleDecay(411, 11, 1); // D+/- + ForceParticleDecay(421, 11, 1); // D0 + ForceParticleDecay(431, 11, 1); // D_s + ForceParticleDecay(4122, 11, 1); // Lambda_c + ForceParticleDecay(4132, 11, 1); // Xsi_c + ForceParticleDecay(4232, 11, 1); // Sigma_c + ForceParticleDecay(4332, 11, 1); // Omega_c + ForceParticleDecay(511, 11, 1); // B0 + ForceParticleDecay(521, 11, 1); // B+/- + ForceParticleDecay(531, 11, 1); // B_s + ForceParticleDecay(5122, 11, 1); // Lambda_b + ForceParticleDecay(5132, 11, 1); // Xsi_b + ForceParticleDecay(5232, 11, 1); // Sigma_b + ForceParticleDecay(5332, 11, 1); // Omega_b + break; + case kDiElectron: + ForceParticleDecay(113, 11, 2); // rho + ForceParticleDecay(333, 11, 2); // phi + ForceParticleDecay(221, 11, 2); // eta + ForceParticleDecay(223, 11, 2); // omega + ForceParticleDecay(443, 11, 2); // J/Psi + ForceParticleDecay(100443, 11, 2); // Psi' + ForceParticleDecay(553, 11, 2); // Upsilon + ForceParticleDecay(100553, 11, 2); // Upsilon' + ForceParticleDecay(200553, 11, 2); // Upsilon'' + break; + case kPsiPrimeJpsiDiElectron: + products[0] = 443; + products[1] = 211; + mult[0] = 1; + mult[1] = 2; + ForceParticleDecay(100443, products, mult, 2, 1); + ForceParticleDecay(443, 11, 2); + break; + case kBJpsiDiMuon: + products[0] = 443; + products[1] = 100443; + mult[0] = 1; + mult[1] = 1; + ForceParticleDecay(511, products, mult, 2); // B0 -> J/Psi (Psi') X + ForceParticleDecay(521, products, mult, 2); // B+/- -> J/Psi (Psi') X + ForceParticleDecay(531, products, mult, 2); // B_s -> J/Psi (Psi') X + ForceParticleDecay(5122, products, mult, 2); // Lambda_b -> J/Psi (Psi') X + ForceParticleDecay(100443, 443, 1); // Psi' -> J/Psi X + ForceParticleDecay(443, 13, 2); // J/Psi -> mu+ mu- + break; + case kBPsiPrimeDiMuon: + ForceParticleDecay(511, 100443, 1); // B0 + ForceParticleDecay(521, 100443, 1); // B+/- + ForceParticleDecay(531, 100443, 1); // B_s + ForceParticleDecay(5122, 100443, 1); // Lambda_b + ForceParticleDecay(100443, 13, 2); // Psi' + break; + case kBJpsiDiElectron: + ForceParticleDecay(511, 443, 1); // B0 + ForceParticleDecay(521, 443, 1); // B+/- + ForceParticleDecay(531, 443, 1); // B_s + ForceParticleDecay(5122, 443, 1); // Lambda_b + ForceParticleDecay(443, 11, 2); // J/Psi + break; + case kBJpsi: + ForceParticleDecay(511, 443, 1); // B0 + ForceParticleDecay(521, 443, 1); // B+/- + ForceParticleDecay(531, 443, 1); // B_s + ForceParticleDecay(5122, 443, 1); // Lambda_b + break; + case kBJpsiUndecayed: + ForceParticleDecay(511, 443, 1); // B0 + ForceParticleDecay(521, 443, 1); // B+/- + ForceParticleDecay(531, 443, 1); // B_s + ForceParticleDecay(5122, 443, 1); // Lambda_b + fPythia->SetMDCY(fPythia->Pycomp(443), 1, 0); // switch-off J/psi + break; + case kBPsiPrimeDiElectron: + ForceParticleDecay(511, 100443, 1); // B0 + ForceParticleDecay(521, 100443, 1); // B+/- + ForceParticleDecay(531, 100443, 1); // B_s + ForceParticleDecay(5122, 100443, 1); // Lambda_b + ForceParticleDecay(100443, 11, 2); // Psi' + break; + case kPiToMu: + ForceParticleDecay(211, 13, 1); // pi->mu + break; + case kKaToMu: + ForceParticleDecay(321, 13, 1); // K->mu + break; + case kAllMuonic: + ForceParticleDecay(211, 13, 1); // pi->mu + ForceParticleDecay(321, 13, 1); // K->mu + break; + case kWToMuon: + ForceParticleDecay(24, 13, 1); // W -> mu + break; + case kWToCharm: + ForceParticleDecay(24, 4, 1); // W -> c + break; + case kWToCharmToMuon: + ForceParticleDecay(24, 4, 1); // W -> c + ForceParticleDecay(411, 13, 1); // D+/- -> mu + ForceParticleDecay(421, 13, 1); // D0 -> mu + ForceParticleDecay(431, 13, 1); // D_s -> mu + ForceParticleDecay(4122, 13, 1); // Lambda_c + ForceParticleDecay(4132, 13, 1); // Xsi_c + ForceParticleDecay(4232, 13, 1); // Sigma_c + ForceParticleDecay(4332, 13, 1); // Omega_c + break; + case kZDiMuon: + ForceParticleDecay(23, 13, 2); // Z -> mu+ mu- + break; + case kZDiElectron: + ForceParticleDecay(23, 11, 2); // Z -> e+ e- + break; + case kHadronicD: + ForceHadronicD(1, 0, 0); + break; + case kHadronicDWithV0: + ForceHadronicD(1, 1, 0); + break; + case kHadronicDWithout4Bodies: + ForceHadronicD(0, 0, 0); + break; + case kHadronicDWithout4BodiesWithV0: + ForceHadronicD(0, 1, 0); + break; + case kHadronicDPionicD0: + ForceHadronicD(1, 0, 3, 1); + break; + case kHadronicDWithV0PionicD0: + ForceHadronicD(1, 1, 3, 1); + break; + case kHadronicDWithout4BodiesPionicD0: + ForceHadronicD(0, 0, 3, 1); + break; + case kHadronicDWithout4BodiesWithV0PionicD0: + ForceHadronicD(0, 1, 3, 1); + break; + case kHadronicDPionicD0pure: + ForceHadronicD(0, 0, 3, 2); + break; + case kHadronicDPionicD0K: + ForceHadronicD(0, 0, 3, 3); + break; + case kHadronicDPionicD0pi: + ForceHadronicD(0, 0, 3, 4); + break; + case kPhiKK: + ForceParticleDecay(333, 321, 2); // Phi->K+K- + break; + case kOmega: + ForceOmega(); + break; + case kLambda: + ForceLambda(); + break; + case kAll: + break; + case kNoDecay: + fPythia->SetMSTJ(21, 0); + break; + case kNoDecayHeavy: + case kNeutralPion: + break; + case kNoDecayBeauty: + SwitchOffBDecay(); + break; + case kElectronEM: + ForceParticleDecay(111, 11, 1); // pi^0 + ForceParticleDecay(221, 11, 1); // eta + ForceParticleDecay(113, 11, 1); // rho + ForceParticleDecay(223, 11, 1); // omega + ForceParticleDecay(331, 11, 1); // etaprime + ForceParticleDecay(333, 11, 1); // phi + ForceParticleDecay(443, 11, 1); // jpsi + break; + case kDiElectronEM: + ForceParticleDecay(111, 11, 2); // pi^0 + ForceParticleDecay(221, 11, 2); // eta + ForceParticleDecay(113, 11, 2); // rho + ForceParticleDecay(223, 11, 2); // omega + ForceParticleDecay(331, 11, 2); // etaprime + ForceParticleDecay(333, 11, 2); // phi + ForceParticleDecay(443, 11, 2); // jpsi + break; + case kGammaEM: + ForceParticleDecay(111, 22, 1); // pi^0 + ForceParticleDecay(221, 22, 1); // eta + ForceParticleDecay(113, 22, 1); // rho + ForceParticleDecay(223, 22, 1); // omega + ForceParticleDecay(331, 22, 1); // etaprime + ForceParticleDecay(333, 22, 1); // phi + ForceParticleDecay(443, 22, 1); // jpsi + ForceParticleDecay(3212, 22, 1); // Sigma 0 + ForceParticleDecay(3122, 22, 1); // Lambda + ForceParticleDecay(310, 22, 1); // K0s + ForceParticleDecay(130, 22, 1); // K0l + ForceParticleDecay(2224, 22, 1); // Delta++ + ForceParticleDecay(2214, 22, 1); // Delta+ + ForceParticleDecay(1114, 22, 1); // Delta- + ForceParticleDecay(2114, 22, 1); // Delta0 + ForceParticleDecay(213, 22, 1); // rho+ + ForceParticleDecay(-213, 22, 1); // rho- + ForceParticleDecay(313, 22, 1); // K0star + break; + case kAllEM: + products1[0] = 22; + products1[1] = 11; + products1[2] = 11; + mult1[0] = 1; + mult1[1] = 1; + mult1[2] = 2; + ForceParticleDecay(111, products1, mult1, 3); // pi0 + ForceParticleDecay(221, products1, mult1, 3); // eta + ForceParticleDecay(113, products1, mult1, 3); // rho + ForceParticleDecay(223, products1, mult1, 3); // omega + ForceParticleDecay(331, products1, mult1, 3); // etaprime + ForceParticleDecay(333, products1, mult1, 3); // phi + ForceParticleDecay(443, products1, mult1, 3); // jpsi + ForceParticleDecay(3212, 22, 1); // Sigma0 + ForceParticleDecay(3122, 22, 1); // Lambda + ForceParticleDecay(310, 22, 1); // K0s + ForceParticleDecay(130, 22, 1); // K0l + ForceParticleDecay(2224, 22, 1); // Delta++ + ForceParticleDecay(2214, 22, 1); // Delta+ + ForceParticleDecay(1114, 22, 1); // Delta- + ForceParticleDecay(2114, 22, 1); // Delta0 + ForceParticleDecay(213, 22, 1); // rho+ + ForceParticleDecay(-213, 22, 1); // rho- + ForceParticleDecay(313, 22, 1); // K0star + break; + case kBeautyUpgrade: + ForceBeautyUpgrade(); + break; + case kHFYellowReport: + ForceHFYellowReport(); + break; + case kLcpKpi: + ForceHadronicD(0, 0, 1); + break; + case kLcpK0S: + ForceHadronicD(0, 0, 2); + break; + case kLcpK0SBDTsig: + ForceHadronicD(0, 0, 4); + break; + case kEtaPrime: + if (gRandom->Rndm() < 0.5) { + products1[0] = 211; + products1[1] = -211; + products1[2] = 221; + mult1[0] = 1; + mult1[1] = 1; + mult1[2] = 1; + ForceParticleDecay(331, products1, mult1, 1); + } else { + ForceParticleDecay(331, 22, 2); + } + break; + default: + break; + } +} + +void PythiaDecayerConfig::SwitchOffHeavyFlavour() { + // Switch off heavy flavour production + // + // Maximum number of quark flavours used in pdf + fPythia->SetMSTP(58, 3); + // Maximum number of flavors that can be used in showers + fPythia->SetMSTJ(45, 3); + // Switch off g->QQbar splitting in decay table + for (Int_t i = 156; i <= 160; i++) + fPythia->SetMDME(i, 1, 0); +} + +void PythiaDecayerConfig::ForceHFYellowReport() { + // + // Force dedicated decay channels of signals interesting + // for the ITS upgrade and specifically the yellow report + // + + // Lb: 100% of them in Lc in final state + + ForceParticleDecay(5122, 4122, 1); + + // B0 -> D-e+nu + const Int_t prod[3] = {411, 11, 12}; + Int_t mult[3] = {1, 1, 1}; + + ForceParticleDecay(511, prod, mult, 3, 1); + ForceHadronicD(0, 0, 0); +} + +void PythiaDecayerConfig::ForceBeautyUpgrade() { + // + // Force dedicated decay channels of signals ineresting + // for the ITS upgrade (Lb, Lc, Xi_c, B) + // + + // Lb: 50% of them in Lc pi+ and the rest with a Lc in final state + if (gRandom->Rndm() < 0.50) { + const Int_t prod3[3] = {4122, 211, 0}; + Int_t mult3[3] = {1, 1, 1}; + ForceParticleDecay(5122, prod3, mult3, 3, 1); + } else { + ForceParticleDecay(5122, 4122, 1); + } + // B+ -> D0pi+ + const Int_t prod[2] = {421, 211}; + Int_t mult[2] = {1, 1}; + ForceParticleDecay(521, prod, mult, 2, 1); + // B0 -> D*-pi+ + const Int_t prod2[2] = {413, 211}; + ForceParticleDecay(511, prod2, mult, 2, 1); + // Bs -> Ds-pi+ + const Int_t prod3[2] = {431, 211}; + ForceParticleDecay(531, prod3, mult, 2, 1); + // force charm hadronic decays (D mesons and Lc) + ForceHadronicD(0, 0, 0); +} + +Int_t PythiaDecayerConfig::CountProducts(Int_t channel, Int_t particle) { + // Count number of decay products + Int_t np = 0; + for (Int_t i = 1; i <= 5; i++) { + if (TMath::Abs(fPythia->GetKFDP(channel, i)) == particle) + np++; + } + return np; +} + +void PythiaDecayerConfig::ForceHadronicD(Int_t optUse4Bodies, Int_t optUseDtoV0, + Int_t optForceLcChannel, + Int_t optUsePionicD0) { + + // OmegaC -> Omega pi + Int_t iOmegaC = 4332; + Int_t productsOc[2] = {211, 3334}, multOc[2] = {1, 1}; + ForceParticleDecay(iOmegaC, productsOc, multOc, 2, 1); + + // Force golden D decay modes + // + const Int_t kNHadrons = 7; + Int_t channel; + Int_t hadron[kNHadrons] = {411, 421, 431, 4112, 4122, 4232, 4132}; + + // for D+ -> K0* (-> K- pi+) pi+ + Int_t iKstar0 = 313; + Int_t iKstarbar0 = -313; + Int_t products[2] = {kKPlus, kPiMinus}, mult[2] = {1, 1}; + ForceParticleDecay(iKstar0, products, mult, 2); + // for Ds -> Phi pi+ + Int_t iPhi = 333; + ForceParticleDecay(iPhi, kKPlus, 2); // Phi->K+K- + // for D0 -> rho0 pi+ k- + Int_t iRho0 = 113; + ForceParticleDecay(iRho0, kPiPlus, 2); // Rho0->pi+pi- + // for Lambda_c -> Delta++ K- + Int_t iDeltaPP = 2224; + Int_t productsD[2] = {kProton, kPiPlus}, multD[2] = {1, 1}; + ForceParticleDecay(iDeltaPP, productsD, multD, 2); + // for Lambda_c -> Lambda(1520) pi+ -> p K- pi+ + Int_t iLambda1520 = 3124; + Int_t productsL[2] = {kProton, kKMinus}, multL[2] = {1, 1}; + ForceParticleDecay(iLambda1520, productsL, multL, 2); + // for Lambda_c -> Lambda pi+ + Int_t iLambda = 3122; + // for Lambda_c -> antiK0 p + Int_t iK0bar = -311; + // for Xic+->Xi-pi+pi+, Xic+->Xi0*pi+,Xi0*->Xi-pi+ and Xic0->Xi-pi+ channels + Int_t iXiMinus = 3312, iXiStar0 = 3324; + + Int_t decayP1[kNHadrons][4] = { + {kKMinus, kPiPlus, kPiPlus, 0}, {kKMinus, kPiPlus, 0, 0}, + {kKPlus, iKstarbar0, 0, 0}, {-1, -1, -1, -1}, + {kProton, iKstarbar0, 0, 0}, {kProton, iKstarbar0, 0, 0}, + {kPiPlus, iXiMinus, 0, 0}}; + Int_t decayP2[kNHadrons][4] = {{iKstarbar0, kPiPlus, 0, 0}, + {kKMinus, kPiPlus, kPiPlus, kPiMinus}, + {iPhi, kPiPlus, 0, 0}, + {-1, -1, -1, -1}, + {iDeltaPP, kKMinus, 0, 0}, + {kProton, kKMinus, kPiPlus, 0}, + {-1, -1, -1, -1}}; + Int_t decayP3[kNHadrons][4] = {{kPiPlus, iPhi, 0, 0}, + {kKMinus, kPiPlus, iRho0, 0}, + {kKPlus, iK0bar, 0, 0}, + {-1, -1, -1, -1}, + {kProton, kKMinus, kPiPlus, 0}, + {kPiPlus, kPiPlus, iXiMinus, 0}, + {-1, -1, -1, -1}}; + // for Lambda_c -> Lambda_1520 pi+ -> p K- pi+, D0-> K*0 pi+ pi- -> K3pi + Int_t decayP4[kNHadrons][4] = {{iKstarbar0, kKPlus, 0, 0}, + {iKstarbar0, kPiPlus, kPiMinus, 0}, + {-1, -1, -1, -1}, + {-1, -1, -1, -1}, + {iLambda1520, kPiPlus, 0, 0}, + {kPiPlus, iXiStar0, 0, 0}, + {-1, -1, -1, -1}}; + // for Lambda_c -> Lambda pi+, D0 -> pi0 pi+ pi- + Int_t decayP5[kNHadrons][4] = { + {iK0bar, kPiPlus, 0, 0}, {kPiPlus, kPiMinus, kPi0, 0}, {-1, -1, -1, -1}, + {-1, -1, -1, -1}, {iLambda, kPiPlus, 0, 0}, {-1, -1, -1, -1}, + {-1, -1, -1, -1}}; + + // for Lambda_c -> K0bar p, D0 -> K- pi+ pi0, D+ -> K0s pi+ pi0 + Int_t decayP6[kNHadrons][4] = {{iK0bar, kPiPlus, kPi0, 0}, + {kKMinus, kPiPlus, kPi0, 0}, + {-1, -1, -1, -1}, + {-1, -1, -1, -1}, + {kProton, iK0bar, 0, 0}, + {-1, -1, -1, -1}, + {-1, -1, -1, -1} + + }; + + if (optUse4Bodies == 0) { + for (Int_t iDau = 0; iDau < 4; iDau++) { + decayP2[1][iDau] = -1; + decayP3[1][iDau] = -1; + decayP4[1][iDau] = -1; + } + } + if (optUseDtoV0 == 0) { + for (Int_t iDau = 0; iDau < 4; iDau++) { + decayP3[2][iDau] = -1; // swicth off Ds->K0K+ + decayP5[0][iDau] = -1; // swicth off D+->K0pi+ + } + } + if (optUsePionicD0 == 0) { + for (Int_t iDau = 0; iDau < 4; iDau++) { + decayP5[1][iDau] = -1; // switch off D0->pi0pi+pi- + decayP6[1][iDau] = -1; // switch off D0->pi0pi+K- + decayP6[0][iDau] = -1; // switch off D+->K0spi+pi0 + } + } else { + // Pi0 options + // - 1: both pionic and D0 -> K- pi+ + // - 2: only pionic modes, both D0 -> K- pi+ pi0 and D0 -> pi0 pi+ pi- + // - 3: only pionic modes, only D0 -> K- pi+ pi0 + // - 4: only pionic modes, only D0 -> pi0 pi+ pi- + switch (optUsePionicD0) { + case 1: + break; + case 2: { + // switch off D0 -> K- pi+ + for (Int_t iDau = 0; iDau < 4; iDau++) { + decayP1[1][iDau] = -1; + } + break; + } + case 3: { + for (Int_t iDau = 0; iDau < 4; iDau++) { + decayP1[1][iDau] = -1; // switch off D0 -> K- pi+ + decayP5[1][iDau] = -1; // switch off D0->pi0pi+pi- + } + break; + } + case 4: { + for (Int_t iDau = 0; iDau < 4; iDau++) { + decayP1[1][iDau] = -1; // switch off D0 -> K- pi+ + decayP6[1][iDau] = -1; // switch off D0->pi0pi+K- + } + break; + } + default: + break; + }; + // For D+ force decays into pi0 + X + for (Int_t iDau = 0; iDau < 4; iDau++) { + // D+ + decayP1[0][iDau] = -1; + decayP2[0][iDau] = -1; + decayP3[0][iDau] = -1; + decayP4[0][iDau] = -1; + decayP5[0][iDau] = -1; + } + } + + for (Int_t ihadron = 0; ihadron < kNHadrons; ihadron++) { + Int_t kc = fPythia->Pycomp(hadron[ihadron]); + Int_t ifirst = fPythia->GetMDCY(kc, 2); + Int_t ilast = ifirst + fPythia->GetMDCY(kc, 3) - 1; + Double_t norm = 0.; + for (channel = ifirst; channel <= ilast; channel++) + norm += fPythia->GetBRAT(channel); + if (norm < 1. - 1.e-12 || norm > 1. + 1.e-12) { + char pName[16]; + fPythia->Pyname(hadron[ihadron], pName); + printf( + "Total branching ratio of %s (PDG code = %d) not equal to 1 (= %f)", + pName, hadron[ihadron], norm); + } + fBraPart[kc] = norm; + fPythia->SetMDCY(kc, 1, 1); + + for (channel = ifirst; channel <= ilast; channel++) { + if ((fPythia->GetKFDP(channel, 1) == decayP1[ihadron][0] && + fPythia->GetKFDP(channel, 2) == decayP1[ihadron][1] && + fPythia->GetKFDP(channel, 3) == decayP1[ihadron][2] && + fPythia->GetKFDP(channel, 4) == decayP1[ihadron][3] && + fPythia->GetKFDP(channel, 5) == 0) || + (fPythia->GetKFDP(channel, 1) == decayP2[ihadron][0] && + fPythia->GetKFDP(channel, 2) == decayP2[ihadron][1] && + fPythia->GetKFDP(channel, 3) == decayP2[ihadron][2] && + fPythia->GetKFDP(channel, 4) == decayP2[ihadron][3] && + fPythia->GetKFDP(channel, 5) == 0) || + (fPythia->GetKFDP(channel, 1) == decayP3[ihadron][0] && + fPythia->GetKFDP(channel, 2) == decayP3[ihadron][1] && + fPythia->GetKFDP(channel, 3) == decayP3[ihadron][2] && + fPythia->GetKFDP(channel, 4) == decayP3[ihadron][3] && + fPythia->GetKFDP(channel, 5) == 0) || + (fPythia->GetKFDP(channel, 1) == decayP4[ihadron][0] && + fPythia->GetKFDP(channel, 2) == decayP4[ihadron][1] && + fPythia->GetKFDP(channel, 3) == decayP4[ihadron][2] && + fPythia->GetKFDP(channel, 4) == decayP4[ihadron][3] && + fPythia->GetKFDP(channel, 5) == 0) || + (fPythia->GetKFDP(channel, 1) == decayP5[ihadron][0] && + fPythia->GetKFDP(channel, 2) == decayP5[ihadron][1] && + fPythia->GetKFDP(channel, 3) == decayP5[ihadron][2] && + fPythia->GetKFDP(channel, 4) == decayP5[ihadron][3] && + fPythia->GetKFDP(channel, 5) == 0) || + (fPythia->GetKFDP(channel, 1) == decayP6[ihadron][0] && + fPythia->GetKFDP(channel, 2) == decayP6[ihadron][1] && + fPythia->GetKFDP(channel, 3) == decayP6[ihadron][2] && + fPythia->GetKFDP(channel, 4) == decayP6[ihadron][3] && + fPythia->GetKFDP(channel, 5) == 0)) + + { + fPythia->SetMDME(channel, 1, 1); + } else { + fPythia->SetMDME(channel, 1, 0); + fBraPart[kc] -= fPythia->GetBRAT(channel); + } // selected channel ? + } // decay channels + if (norm > 0) + fBraPart[kc] /= norm; + } // hadrons + + // Options for forcing Lc decays for dedicated productions + Int_t prodLcpKpi[3] = {2212, 321, 211}; + Int_t multLcpKpi[3] = {1, 1, 1}; + + Int_t prodLcpK0S[2] = {2212, 311}; + Int_t multLcpK0S[2] = {1, 1}; + + Int_t prodLcLambdaPiPlPi0[3] = {iLambda, kPiPlus, kPi0}; + Int_t multLcLambdaPiPlPi0[3] = {1, 1, 1}; + if (optForceLcChannel == 1) { // pKpi + ForceParticleDecay(4122, prodLcpKpi, multLcpKpi, 3, 1); + } + if (optForceLcChannel == 2) { // pK0S + ForceParticleDecay(4122, prodLcpK0S, multLcpK0S, 2, 1); // Lc to p + K0 + } + if (optForceLcChannel == 3) { // Lambda Pi+ Pi0 + ForceParticleDecay(4122, prodLcLambdaPiPlPi0, multLcLambdaPiPlPi0, 3, 1); + } + + if (optForceLcChannel == + 4) { // pK0S for BDT signal training: force all K0->K0S->pi+pi- + ForceParticleDecay(4122, prodLcpK0S, multLcpK0S, 2, 1); // Lc to p + K0 + ForceParticleDecay(311, 310, 1); // K0 -> K0S + ForceParticleDecay(310, 211, 2); // K0S -> pi+ pi- + } +} + +void PythiaDecayerConfig::ForceParticleDecay(Int_t particle, Int_t product, + Int_t mult) { + // + // Force decay of particle into products with multiplicity mult + + Int_t kc = fPythia->Pycomp(particle); + fPythia->SetMDCY(kc, 1, 1); + Int_t ifirst = fPythia->GetMDCY(kc, 2); + Int_t ilast = ifirst + fPythia->GetMDCY(kc, 3) - 1; + Double_t norm = 0.; + for (Int_t channel = ifirst; channel <= ilast; channel++) { + norm += fPythia->GetBRAT(channel); + } + if (norm < 1. - 1.e-12 || norm > 1. + 1.e-12) { + char pName[16]; + fPythia->Pyname(particle, pName); + printf("Total branching ratio of %s (PDG code = %d) not equal to 1 (= %f)", + pName, particle, norm); + } + fBraPart[kc] = norm; + // + // Loop over decay channels + for (Int_t channel = ifirst; channel <= ilast; channel++) { + if (CountProducts(channel, product) >= mult) { + fPythia->SetMDME(channel, 1, 1); + } else { + fPythia->SetMDME(channel, 1, 0); + fBraPart[kc] -= fPythia->GetBRAT(channel); + } + } + if (norm > 0.) + fBraPart[kc] /= norm; +} + +void PythiaDecayerConfig::ForceParticleDecay(Int_t particle, + const Int_t *products, Int_t *mult, + Int_t npart, Bool_t flag) { + // + // Force decay of particle into products with multiplicity mult + + Int_t kc = fPythia->Pycomp(particle); + fPythia->SetMDCY(kc, 1, 1); + Int_t ifirst = fPythia->GetMDCY(kc, 2); + Int_t ilast = ifirst + fPythia->GetMDCY(kc, 3) - 1; + Double_t norm = 0.; + for (Int_t channel = ifirst; channel <= ilast; channel++) + norm += fPythia->GetBRAT(channel); + if (norm < 1. - 1.e-12 || norm > 1. + 1.e-12) { + char pName[16]; + fPythia->Pyname(particle, pName); + printf("Total branching ratio of %s (PDG code = %d) not equal to 1 (= %f)", + pName, particle, norm); + } + fBraPart[kc] = norm; + // + // Loop over decay channels + for (Int_t channel = ifirst; channel <= ilast; channel++) { + Int_t nprod = 0; + for (Int_t i = 0; i < npart; i++) { + nprod += (CountProducts(channel, products[i]) >= mult[i]); + } + if ((nprod && !flag) || ((nprod == npart) && flag)) { + fPythia->SetMDME(channel, 1, 1); + } else { // + fPythia->SetMDME(channel, 1, 0); + fBraPart[kc] -= fPythia->GetBRAT(channel); + } + } + if (norm > 0.) + fBraPart[kc] /= norm; +} + +void PythiaDecayerConfig::ForceOmega() { + // Force Omega -> Lambda K- Decay + Int_t kc = fPythia->Pycomp(3334); + fPythia->SetMDCY(kc, 1, 1); + Int_t ifirst = fPythia->GetMDCY(kc, 2); + Int_t ilast = ifirst + fPythia->GetMDCY(kc, 3) - 1; + for (Int_t channel = ifirst; channel <= ilast; channel++) { + if (fPythia->GetKFDP(channel, 1) == kLambda0 && + fPythia->GetKFDP(channel, 2) == kKMinus && + fPythia->GetKFDP(channel, 3) == 0) { + fPythia->SetMDME(channel, 1, 1); + } else { + fPythia->SetMDME(channel, 1, 0); + } // selected channel ? + } // decay channels +} + +void PythiaDecayerConfig::ForceLambda() { + // Force Lambda -> p pi- + Int_t kc = fPythia->Pycomp(3122); + fPythia->SetMDCY(kc, 1, 1); + Int_t ifirst = fPythia->GetMDCY(kc, 2); + Int_t ilast = ifirst + fPythia->GetMDCY(kc, 3) - 1; + for (Int_t channel = ifirst; channel <= ilast; channel++) { + if (fPythia->GetKFDP(channel, 1) == kProton && + fPythia->GetKFDP(channel, 2) == kPiMinus && + fPythia->GetKFDP(channel, 3) == 0) { + fPythia->SetMDME(channel, 1, 1); + } else { + fPythia->SetMDME(channel, 1, 0); + } // selected channel ? + } // decay channels +} + +void PythiaDecayerConfig::SwitchOffBDecay() { + // Switch off B-decays + Int_t heavyB[] = {511, 521, 531, 5122, 5132, 5232, 5332}; + for (int i = 0; i < 4; i++) { + fPythia->SetMDCY(fPythia->Pycomp(heavyB[i]), 1, 0); + } +} + +Float_t PythiaDecayerConfig::GetPartialBranchingRatio(Int_t kf) { + // Get branching ratio + Int_t kc = fPythia->Pycomp(TMath::Abs(kf)); + return fBraPart[kc]; +} + +Float_t PythiaDecayerConfig::GetLifetime(Int_t kf) { + // Get branching ratio + Int_t kc = fPythia->Pycomp(TMath::Abs(kf)); + return fPythia->GetPMAS(kc, 4) * 3.3333e-12; +} + +void PythiaDecayerConfig::Copy(TObject &) const { + // + // Copy *this onto PythiaDecayerConfig -- not implemented + // + Fatal("Copy", "Not implemented!\n"); +} diff --git a/GeneratorParam/PythiaDecayerConfig.h b/GeneratorParam/PythiaDecayerConfig.h new file mode 100644 index 0000000..d3623a7 --- /dev/null +++ b/GeneratorParam/PythiaDecayerConfig.h @@ -0,0 +1,135 @@ +#ifndef PYTHIADECAYERCONFIG_H +#define PYTHIADECAYERCONFIG_H +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// Class to generate particles from using paramtrized pT and y distributions. +// Distributions are obtained from pointer to object of type +// GeneratorParamLibBase. Decays are performed using Pythia. +// andreas.morsch@cern.ch + +// Helper class for the configuration of the Pythia6 decayer +// Allows to force decay channels. +// Author: andreas.morsch@cern.ch + +#include + +typedef enum { + kBSemiElectronic, + kSemiElectronic, + kDiElectron, + kBSemiMuonic, + kDSemiMuonic, + kSemiMuonic, + kDiMuon, + kJpsiDiMuon, + kBJpsiDiMuon, + kBJpsiDiElectron, + kBPsiPrimeDiMuon, + kBPsiPrimeDiElectron, + kPiToMu, + kKaToMu, + kNoDecay, + kHadronicD, + kHadronicDWithout4Bodies, + kOmega, + kLambda, + kPhiKK, + kAll, + kNoDecayHeavy, + kHardMuons, + kBJpsi, + kBJpsiUndecayed, + kWToMuon, + kWToCharm, + kWToCharmToMuon, + kZDiMuon, + kZDiElectron, + kNeutralPion, + kAllMuonic, + kChiToJpsiGammaToMuonMuon, + kChiToJpsiGammaToElectronElectron, + kNoDecayBeauty, + kPsiPrimeJpsiDiElectron, + kElectronEM, + kGammaEM, + kDiElectronEM, + kBeautyUpgrade, + kHadronicDWithV0, + kHadronicDWithout4BodiesWithV0, + kAllEM, + kLcpKpi, + kLcpK0S, + kHFYellowReport, + kHadronicDPionicD0, + kHadronicDWithV0PionicD0, + kHadronicDWithout4BodiesPionicD0, + kHadronicDWithout4BodiesWithV0PionicD0, + kHadronicDPionicD0pure, + kHadronicDPionicD0K, + kHadronicDPionicD0pi, + kLcpK0SBDTsig, + kEtaPrime, + kXic0Semileptonic, + kHadronicDWithout4BodiesDsPhiPi +} Decay_t; + +class PythiaDecayerConfig : public TObject { +public: + PythiaDecayerConfig(); + PythiaDecayerConfig(const PythiaDecayerConfig &decayerconfig); + // + virtual ~PythiaDecayerConfig() { ; } + virtual void Init(Decay_t decay); + virtual void ForceDecay(); + virtual void SetPatchOmegaDalitz() { fPatchOmegaDalitz = 1; } + virtual void SetDecayerExodus() { fDecayerExodus = 1; } + virtual void HeavyFlavourOff() { fHeavyFlavour = kFALSE; } + virtual void DecayLongLivedParticles() { fLongLived = kTRUE; } + virtual Float_t GetPartialBranchingRatio(Int_t ipart); + virtual Float_t GetLifetime(Int_t kf); + virtual void SwitchOffBDecay(); + virtual void SwitchOffPi0() { fPi0 = 0; } + virtual void SwitchOffParticle(Int_t kf); + +private: + Int_t CountProducts(Int_t channel, Int_t particle); + void ForceParticleDecay(Int_t particle, Int_t product, Int_t mult); + void ForceParticleDecay(Int_t particle, const Int_t *products, Int_t *mult, + Int_t npart, Bool_t flag = 0); + void ForceHadronicD(Int_t optUse4Bodies = 1, Int_t optUseDtoV0 = 0, + Int_t optForceLcChannel = 0, Int_t optUsePionicD0 = 0); + void ForceOmega(); + void ForceLambda(); + void SwitchOffHeavyFlavour(); + void ForceBeautyUpgrade(); + void ForceHFYellowReport(); + Float_t GetBraPart(Int_t kf); + void Copy(TObject &decayer) const; + + PythiaDecayerConfig &operator=(const PythiaDecayerConfig &decayerconfig) { + decayerconfig.Copy(*this); + return (*this); + } + +private: + TPythia6 *fPythia; //! Pointer to AliPythia + Decay_t fDecay; // Forced decay mode + Float_t fBraPart[501]; //! Branching ratios + Bool_t fHeavyFlavour; //! Flag for heavy flavors + Bool_t fLongLived; //! Flag for long lived particle decay + Bool_t fPatchOmegaDalitz; //! Flag to patch the omega Dalitz decays + Bool_t fDecayerExodus; //! Flag for EXODUS decayer + Bool_t fPi0; //! Flag for pi0 decay + static Bool_t fgInit; //! initialization flag + + ClassDef(PythiaDecayerConfig, 1) // AliDecayer implementation using Pythia +}; +#endif diff --git a/GeneratorParam/test.C b/GeneratorParam/test.C new file mode 100644 index 0000000..fa3a946 --- /dev/null +++ b/GeneratorParam/test.C @@ -0,0 +1,23 @@ +void test() +{ + gSystem->Load("libpythia6"); + gSystem->Load("libEGPythia6"); + auto *jpsi = new GeneratorParam(10, new GeneratorParamMUONlib(), GeneratorParamMUONlib::kJpsiFamily, "Vogt PbPb"); + jpsi->SetPtRange(0, 100); + jpsi->SetYRange(-1., +1.); + jpsi->SetDecayer(new TPythia6Decayer()); + jpsi->SetForceDecay(kDiElectron); + jpsi->Init(); + jpsi->Draw(""); + // auto n3 = jpsi->GetPt()->Integral(0., 10., 1.e-6); + jpsi->GenerateEvent(); + auto particles = new TClonesArray("TParticle", 10); + auto n = jpsi->ImportParticles(particles, "all"); + printf("Number of generated particles %5d \n", n); + + for (Int_t i = 0; i < n; i++) { + auto p = *(TParticle*) (particles->At(i)); + printf("%5d %5d %5d %5d %5d\n", i, p.GetPdgCode(), p.GetFirstMother(), p.GetFirstDaughter(), p.GetLastDaughter()); + + } +}