// // This macro based on code: $STAR/StRoot/StarGenerator/macros/starsim.pythia8.C // Author: Nikita Ermakov (coffe92@gmail.com) // void starPythia8(const char *outFileName = "pythia8.root", unsigned int nevents = 10, unsigned int ranseed = 1234, Float_t energy = 510.0) { std::cout << "Loading libraries..." << std::endl; gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); loadSharedLibraries(); gSystem->Load("libMinuit"); gSystem->Load("StarClassLibrary"); gSystem->Load("libgsl"); gSystem->Load("libgslcblas"); gSystem->Load("libVMC.so"); gSystem->Load("libStDb_Tables.so"); gSystem->Load("libgen_Tables.so"); gSystem->Load("libgeometry_Tables.so"); gSystem->Load("libsim_Tables.so"); gSystem->Load("libStarMagField.so"); gSystem->Load("libSt_db_Maker.so"); gSystem->Load("libSt_g2t.so"); gSystem->Load("libSt_geant_Maker.so"); gSystem->Load("StarGeneratorUtil.so"); gSystem->Load("StarGeneratorEvent.so"); gSystem->Load("StarGeneratorBase.so"); gSystem->Load("Pythia8_1_62.so"); gSystem->Load("libMathMore.so"); gSystem->Load("Pythia8_1_62.so"); std::cout << "Libraries have been successfully loaded" << std::endl; /* gROOT->ProcessLine(".L bfc.C"); TString simple = "y2012 agml "; bfc(0, simple ); gSystem->Load("libVMC.so"); gSystem->Load("StarGeneratorUtil.so"); gSystem->Load("StarGeneratorEvent.so"); gSystem->Load("StarGeneratorBase.so" ); gSystem->Load("Pythia8_1_62.so"); gSystem->Load("libMathMore.so"); gSystem->Load("Pythia8_1_62.so" ); // TODO: why do we need to load lib second time? */ // Setup RNG seed and map all ROOT TRandom here /* struct timeval t; gettimeofday(&t, 0); int ranseed = (t.tv_sec*1000) + (t.tv_usec/1000); std::cout << "using random seed = " << ranseed << std::endl; */ StChain *chain = new StChain("StChain"); chain->SetDebug(0); StarRandom::seed(ranseed); StarRandom::capture(); // // Create the primary event generator // StarPrimaryMaker *primary = new StarPrimaryMaker(); primary->SetFileName(outFileName); primary->SetVertex(0.1, -0.1, 0.0); primary->SetSigma(0.1, 0.1, 30.0); // // Setup an event generator // // // Create the pythia 8 event generator and add it to // the primary generator // StarPythia8 *pythia8 = new StarPythia8(); pythia8->SetFrame("CMS", energy); pythia8->SetBlue("proton"); pythia8->SetYell("proton"); pythia8->Set("SoftQCD:minBias = on"); primary->AddGenerator(pythia8); // // Setup cuts on which particles get passed to geant for // simulation. (To run generator in standalone mode, // set ptmin=1.0E9.) // ptmin ptmax // primary->SetPtRange(0.0, -1.0); // GeV // etamin etamax // primary->SetEtaRange(-3.0, +3.0); // phimin phimax // primary->SetPhiRange(0., TMath::TwoPi()); // // Setup a realistic z-vertex distribution: // x = 0 gauss width = 1mm // y = 0 gauss width = 1mm // z = 0 gauss width = 30cm // primary->SetVertex(0., 0., 0.); primary->SetSigma(0.1, 0.1, 30.0); // // Initialize primary event generator and all sub makers // chain->Init(); // // Trigger on nevents // for (int i = 0; i < nevents; i++) { chain->Clear(); chain->Make(); } // // Finish the chain // chain->Finish(); }