ROOT 6 with Python in Mac and pythia 8

Hi all,
When I enter “root/tutorials/pythia” , there is a example, pythia8.C, when I run it:

[code]lis-MacBook-Pro:pythia li$ root -l pythia8.C
root [0]
Processing pythia8.C…

------------------------------------------------------------------------------------
| |
| ------------------------------------------------------------------------------ |
| | | |
| | | |
| | PPP Y Y TTTTT H H III A Welcome to the Lund Monte Carlo! | |
| | P P Y Y T H H I A A This is PYTHIA version 8.205 | |
| | PPP Y T HHHHH I AAAAA Last date of change: 23 Jan 2015 | |
| | P Y T H H I A A | |
| | P Y T H H III A A Now is 14 May 2016 at 19:43:20 | |
| | | |
| | Torbjorn Sjostrand; Department of Astronomy and Theoretical Physics, | |
| | Lund University, Solvegatan 14A, SE-223 62 Lund, Sweden; | |
| | e-mail: torbjorn@thep.lu.se | |
| | Jesper Roy Christiansen; Department of Astronomy and Theoretical Physics, | |
| | Lund University, Solvegatan 14A, SE-223 62 Lund, Sweden; | |
| | e-mail: Jesper.Roy.Christiansen@thep.lu.se | |
| | Nishita Desai; Institut fuer Theoretische Physik, | |
| | Universitaet Heidelberg, Philosophenweg 16, D-69120 Heidelberg, Germany; | |
| | e-mail: Nishita.Desai@cern.ch | |
| | Philip Ilten; Massachusetts Institute of Technology, | |
| | stationed at CERN, CH-1211 Geneva 23, Switzerland; | |
| | e-mail: philten@cern.ch | |
| | Stephen Mrenna; Computing Division, Simulations Group, | |
| | Fermi National Accelerator Laboratory, MS 234, Batavia, IL 60510, USA; | |
| | e-mail: mrenna@fnal.gov | |
| | Stefan Prestel; Theoretical Physics Group, | |
| | SLAC National Accelerator Laboratory, Menlo Park, CA 94025, USA; | |
| | e-mail: prestel@slac.stanford.edu | |
| | Christine O. Rasmussen; Department of Astronomy and Theoretical Physics, | |
| | Lund University, Solvegatan 14A, SE-223 62 Lund, Sweden; | |
| | e-mail: christine.rasmussen@thep.lu.se | |
| | Peter Skands; School of Physics, | |
| | Monash University, PO Box 27, 3800 Melbourne, Australia; | |
| | e-mail: peter.skands@monash.edu | |
| | | |
| | The main program reference is ‘An Introduction to PYTHIA 8.2’, | |
| | T. Sjostrand et al, arXiv:1410.3012 [hep-ph] | |
| | | |
| | The main physics reference is the ‘PYTHIA 6.4 Physics and Manual’, | |
| | T. Sjostrand, S. Mrenna and P. Skands, JHEP05 (2006) 026 [hep-ph/0603175]. | |
| | | |
| | An archive of program versions and documentation is found on the web: | |
| | http://www.thep.lu.se/Pythia | |
| | | |
| | This program is released under the GNU General Public Licence version 2. | |
| | Please respect the MCnet Guidelines for Event Generator Authors and Users. | |
| | | |
| | Disclaimer: this program comes without any guarantees. | |
| | Beware of errors and use common sense when interpreting results. | |
| | | |
| | Copyright © 2015 Torbjorn Sjostrand | |
| | | |
| | | |
| ------------------------------------------------------------------------------ |
| |
------------------------------------------------------------------------------------

PYTHIA Warning in PhaseSpace2to2tauyz::trialKin: maximum for cross section violated

------- PYTHIA Process Initialization --------------------------
| |
| We collide p+ with p+ at a CM energy of 1.400e+04 GeV |

Subprocess Code
------------------------------------------------------------------
g g -> g g 111
g g -> q qbar (uds) 112
q g -> q g 113
q q(bar)’ -> q q(bar)’ 114
q qbar -> g g 115
q qbar -> q’ qbar’ (uds) 116
g g -> c cbar 121
q qbar -> c cbar 122
g g -> b bbar 123
q qbar -> b bbar 124

------- End PYTHIA Process Initialization -----------------------

------- PYTHIA Multiparton Interactions Initialization ---------
| |
| sigmaNonDiffractive = 57.54 mb |
| |
| pT0 = 2.65 gives sigmaInteraction = 331.57 mb: accepted |
| |
------- End PYTHIA Multiparton Interactions Initialization -----

------- PYTHIA Flag + Mode + Parm + Word + FVec + MVec + PVec Settings (changes only) -------------------------
| |
| Name | Now | Default Min Max |
| | | |
| HardQCD:all | on | off |
| |
------- End PYTHIA Flag + Mode + Parm + Word + FVec + MVec + PVec Settings ------------------------------------

-------- PYTHIA Particle Data Table (changed only) ------------------------------------------------------------------------------

  id   name            antiName         spn chg col      m0        mWidth      mMin       mMax       tau0    res dec ext vis wid
         no onMode   bRatio   meMode     products 

no particle data has been changed from its default value

-------- End PYTHIA Particle Data Table -----------------------------------------------------------------------------------------

*** Break *** segmentation violation
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
Root >
[/code]

Why there is a break down?

Hi,

We don’t know, that likely depends on your code.

Please try with root -l pythia8.C+ (note the trailing ‘+’), that might tell you where if fails.

Cheers, Axel.

[quote=“Axel”]Hi,

We don’t know, that likely depends on your code.

Please try with root -l pythia8.C+ (note the trailing ‘+’), that might tell you where if fails.

Cheers, Axel.[/quote]

Hi,
I will try it. But I meet another problem in install these packages. Because since I can’t solve this, I tried to compile pythia 8 with ROOT, so I re-install PYTHIA8,

[code]lis-MacBook-Pro:pythia8205 li$ ./configure --prefix=/Users/li/tools/packages/pythia8 --with-fastjet3=/Users/li/tools/packages/fastjet --with-fastjet3-include=/Users/li/tools/packages/fastjet/include/ --with-fastjet3-lib=/Users/li/tools/packages/fastjet/lib/ --with-hepmc2=/Users/li/tools/packages/hepmc/ --with-hepmc2-include=/Users/li/tools/packages/hepmc/include/ --with-hepmc2-lib=/Users/li/tools/packages/hepmc/lib/ --enable-shared --with-root=/Users/li/tools/root/ --with-root-include=/Users/li/tools/root/include/ --with-root-lib=/Users/li/tools/root/lib/ --with-root-bin=/Users/li/tools/root/bin/
WARNING: Disabling ROOT - library Cint missing.

PYTHIA Configuration Summary

Configured for DARWIN with the following options:
–enable-shared

The following optional external packages will be used:

  • FASTJET3

  • HEPMC2
    [/code]

    It seems that Cint is not in ROOT/lib, include/ bin folders. Do you know how to solve it, can you please tell me ?

Best,
Li

Hi,

We cannot solve that - it’s a bug in Pythia: ROOT 6 has no libCint and they should not check for that (but libCore). Maybe you could ask them?

That said - you don’t need to configure Pythia with ROOT to use ROOT with Pythia.

Cheers, Axel.

[quote=“Axel”]Hi,

We cannot solve that - it’s a bug in Pythia: ROOT 6 has no libCint and they should not check for that (but libCore). Maybe you could ask them?

That said - you don’t need to configure Pythia with ROOT to use ROOT with Pythia.

Cheers, Axel.[/quote]

Hi Axel,
I agree with you, I think it should be PYTHIA problem, I will send a email to ask them. In pythia example, they provide 2 examples to use ROOT in Pythia.

Because I want to, instead use hepmc2 format , use ROOT format ( or STDHEP format) for the output of pythia and fastjet . So I need either compile ROOT with PYTHIA so I can use PYTHIA in ROOT or compile PYTHIA with ROOT so I can use root head file in PYTHIA.

I think if these packages can always support root file ( or other identify format ) , it will be very convenient for us to use them. Or I need to learn different format rules and write code to read them…

Best,
Li

[quote=“Axel”]Hi,

We don’t know, that likely depends on your code.

Please try with root -l pythia8.C+ (note the trailing ‘+’), that might tell you where if fails.

Cheers, Axel.[/quote]

Hi Axel,
I tried it, the error information is a little wired,

lis-MacBook-Pro:pythia li$ root -l pythia8.C+ root [0] Processing pythia8.C+... Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/li/tools/root/tutorials/pythia/./pythia8_C.so In file included from input_line_12:9: /Users/li/tools/root/tutorials/pythia/./pythia8.C:22:28: error: use of undeclared identifier 'gSystem' const char *p8dataenv = gSystem->Getenv("PYTHIA8DATA"); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:24:27: error: use of undeclared identifier 'gSystem' const char *p8env = gSystem->Getenv("PYTHIA8"); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:26:10: error: use of undeclared identifier 'Error' Error("pythia8.C", ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:30:15: error: variable has incomplete type 'TString' TString p8d = p8env; ^ /Users/li/tools/root/include/Rtypes.h:50:7: note: forward declaration of 'TString' class TString; ^ In file included from input_line_12:9: /Users/li/tools/root/tutorials/pythia/./pythia8.C:32:7: error: use of undeclared identifier 'gSystem' gSystem->Setenv("PYTHIA8DATA", p8d); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:35:23: error: use of undeclared identifier 'gSystem' const char* path = gSystem->ExpandPathName("$PYTHIA8DATA"); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:36:8: error: use of undeclared identifier 'gSystem' if (gSystem->AccessPathName(path)) { ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:37:10: error: use of undeclared identifier 'Error' Error("pythia8.C", ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:44:4: error: use of undeclared identifier 'gSystem' gSystem->Load("$PYTHIA8/lib/libpythia8"); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:46:4: error: use of undeclared identifier 'gSystem' gSystem->Load("libEG"); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:47:4: error: use of undeclared identifier 'gSystem' gSystem->Load("libEGPythia8"); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:49:4: error: unknown type name 'TH1F' TH1F* etaH = new TH1F("etaH", "Pseudorapidity", 120, -12., 12.); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:49:21: error: unknown type name 'TH1F' TH1F* etaH = new TH1F("etaH", "Pseudorapidity", 120, -12., 12.); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:50:4: error: unknown type name 'TH1F' TH1F* ptH = new TH1F("ptH", "pt", 50, 0., 10.); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:50:21: error: unknown type name 'TH1F' TH1F* ptH = new TH1F("ptH", "pt", 50, 0., 10.); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:54:4: error: unknown type name 'TClonesArray' TClonesArray* particles = new TClonesArray("TParticle", 1000); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:54:34: error: unknown type name 'TClonesArray' TClonesArray* particles = new TClonesArray("TParticle", 1000); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:56:4: error: unknown type name 'TPythia8' TPythia8* pythia8 = new TPythia8(); ^ /Users/li/tools/root/tutorials/pythia/./pythia8.C:56:28: error: unknown type name 'TPythia8' TPythia8* pythia8 = new TPythia8(); ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] Error in <ACLiC>: Dictionary generation failed! root [1]

While I am sure that I can use:

lis-MacBook-Pro:pythia li$ root -l root [0] gSystem->Load("libEG") (int) 0 root [1] gSystem->Load("libEGPythia8") (int) 0 root [2]

Best,
Li

You are trying to run one of ROOT’s tutorials, which is NOT prepared for ACLiC (i.e. you must NOT try to precompile it).
Your “segmentation violation” seems to come from the first call to “pythia8->GenerateEvent();” (or from the preceding “pythia8->Initialize(…);” call).
In the attachment, you can find my output from ROOT 6.06/04 (Ubuntu 14.04.4 LTS / x86_64).
pythia8.C.out.txt (69 KB)

[quote=“Pepe Le Pew”]You are trying to run one of ROOT’s tutorials, which is NOT prepared for ACLiC (i.e. you must NOT try to precompile it).
Your “segmentation violation” seems to come from the first call to “pythia8->GenerateEvent();” (or from the preceding “pythia8->Initialize(…);” call).
In the attachment, you can find my output from ROOT 6.06/04 (Ubuntu 14.04.4 LTS / x86_64).[/quote]

Hi,
Thanks to your nice result. I tested it, I can

[code]lis-MacBook-Pro:pythia li$ root -l
root [0] gSystem->Load(“libEG”)
(int) 0
root [1] gSystem->Load(“libEGPythia8”)
(int) 0
root [2] TPythia8 *pythia8 = new TPythia8()

------------------------------------------------------------------------------------
| |
| ------------------------------------------------------------------------------ |
| | | |
| | | |
| | PPP Y Y TTTTT H H III A Welcome to the Lund Monte Carlo! | |
| | P P Y Y T H H I A A This is PYTHIA version 8.205 | |
| | PPP Y T HHHHH I AAAAA Last date of change: 23 Jan 2015 | |
| | P Y T H H I A A | |
| | P Y T H H III A A Now is 16 May 2016 at 19:17:41 | |
| | | |
| | Torbjorn Sjostrand; Department of Astronomy and Theoretical Physics, | |
| | Lund University, Solvegatan 14A, SE-223 62 Lund, Sweden; | |
| | e-mail: torbjorn@thep.lu.se | |
| | Jesper Roy Christiansen; Department of Astronomy and Theoretical Physics, | |
| | Lund University, Solvegatan 14A, SE-223 62 Lund, Sweden; | |
| | e-mail: Jesper.Roy.Christiansen@thep.lu.se | |
| | Nishita Desai; Institut fuer Theoretische Physik, | |
| | Universitaet Heidelberg, Philosophenweg 16, D-69120 Heidelberg, Germany; | |
| | e-mail: Nishita.Desai@cern.ch | |
| | Philip Ilten; Massachusetts Institute of Technology, | |
| | stationed at CERN, CH-1211 Geneva 23, Switzerland; | |
| | e-mail: philten@cern.ch | |
| | Stephen Mrenna; Computing Division, Simulations Group, | |
| | Fermi National Accelerator Laboratory, MS 234, Batavia, IL 60510, USA; | |
| | e-mail: mrenna@fnal.gov | |
| | Stefan Prestel; Theoretical Physics Group, | |
| | SLAC National Accelerator Laboratory, Menlo Park, CA 94025, USA; | |
| | e-mail: prestel@slac.stanford.edu | |
| | Christine O. Rasmussen; Department of Astronomy and Theoretical Physics, | |
| | Lund University, Solvegatan 14A, SE-223 62 Lund, Sweden; | |
| | e-mail: christine.rasmussen@thep.lu.se | |
| | Peter Skands; School of Physics, | |
| | Monash University, PO Box 27, 3800 Melbourne, Australia; | |
| | e-mail: peter.skands@monash.edu | |
| | | |
| | The main program reference is ‘An Introduction to PYTHIA 8.2’, | |
| | T. Sjostrand et al, arXiv:1410.3012 [hep-ph] | |
| | | |
| | The main physics reference is the ‘PYTHIA 6.4 Physics and Manual’, | |
| | T. Sjostrand, S. Mrenna and P. Skands, JHEP05 (2006) 026 [hep-ph/0603175]. | |
| | | |
| | An archive of program versions and documentation is found on the web: | |
| | http://www.thep.lu.se/Pythia | |
| | | |
| | This program is released under the GNU General Public Licence version 2. | |
| | Please respect the MCnet Guidelines for Event Generator Authors and Users. | |
| | | |
| | Disclaimer: this program comes without any guarantees. | |
| | Beware of errors and use common sense when interpreting results. | |
| | | |
| | Copyright © 2015 Torbjorn Sjostrand | |
| | | |
| | | |
| ------------------------------------------------------------------------------ |
| |
------------------------------------------------------------------------------------

(TPythia8 ) 0x7fdf874d3c00
root [3] pythia8->ReadString(“HardQCD:all=on”)
root [4] pythia8->Initialize(2212 /
p /, 2212 / p /, 14000. / TeV */)
PYTHIA Warning in PhaseSpace2to2tauyz::trialKin: maximum for cross section violated

------- PYTHIA Process Initialization --------------------------
| |
| We collide p+ with p+ at a CM energy of 1.400e+04 GeV |

Subprocess Code
------------------------------------------------------------------
g g -> g g 111
g g -> q qbar (uds) 112
q g -> q g 113
q q(bar)’ -> q q(bar)’ 114
q qbar -> g g 115
q qbar -> q’ qbar’ (uds) 116
g g -> c cbar 121
q qbar -> c cbar 122
g g -> b bbar 123
q qbar -> b bbar 124

------- End PYTHIA Process Initialization -----------------------

------- PYTHIA Multiparton Interactions Initialization ---------
| |
| sigmaNonDiffractive = 57.54 mb |
| |
| pT0 = 2.65 gives sigmaInteraction = 331.57 mb: accepted |
| |
------- End PYTHIA Multiparton Interactions Initialization -----

------- PYTHIA Flag + Mode + Parm + Word + FVec + MVec + PVec Settings (changes only) -------------------------
| |
| Name | Now | Default Min Max |
| | | |
| HardQCD:all | on | off |
| |
------- End PYTHIA Flag + Mode + Parm + Word + FVec + MVec + PVec Settings ------------------------------------

-------- PYTHIA Particle Data Table (changed only) ------------------------------------------------------------------------------

  id   name            antiName         spn chg col      m0        mWidth      mMin       mMax       tau0    res dec ext vis wid
         no onMode   bRatio   meMode     products 

no particle data has been changed from its default value

-------- End PYTHIA Particle Data Table -----------------------------------------------------------------------------------------

(Bool_t) true

root [5] pythia8->GenerateEvent()

-------- PYTHIA Info Listing ----------------------------------------

Beam A: id = 2212, pz = 7.000e+03, e = 7.000e+03, m = 9.383e-01.
Beam B: id = 2212, pz = -7.000e+03, e = 7.000e+03, m = 9.383e-01.


[/code]

In short , I can use GenerateEvent() good in interactive shell, but in the script , this line lead a crack as you guess. It’s wired…

Best,
Li