I’m trying to use Pythia and Root.
If I only wanted to use Root I’d use this command in the terminal:
> g++ -o testy ./testy.cpp `root-config --cflags --glibs`
Now that I want to use also Pythia, I’m using this command:
> g++ -I $PYTHIA8/include -o testy ./testy.cpp `root-config --cflags --glibs`
And it does “find” Pythia, the problem is that it doesn’t find the compiled library, or at least that’s what I understand is happening from this error message:
> Undefined symbols for architecture x86_64:
"Pythia8::Pythia::readString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool)", referenced from:
_main in testy-a5469e.o
"Pythia8::Pythia::init()", referenced from:
_main in testy-a5469e.o
"Pythia8::Pythia::next()", referenced from:
_main in testy-a5469e.o
"Pythia8::Pythia::stat()", referenced from:
_main in testy-a5469e.o
"Pythia8::Pythia::Pythia(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool)", referenced from:
_main in testy-a5469e.o
"Pythia8::Pythia::~Pythia()", referenced from:
_main in testy-a5469e.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The code itself is this one:
>#include <iostream>
using namespace std;
#include "Pythia8/Pythia.h"
#include "TROOT.h"
using namespace Pythia8;
int main()
{
//Dar las caracteristicas del rayo
Pythia pythia;
//pythia.readString("SoftQCD:all = on");
pythia.readString("HardQCD:all = on"); //en el articulo mencionan que el principal interes es en eventos duros de cromodinamica
pythia.readString("Beams:eCM = 13000."); //declara la energia del CM
pythia.readString("PhaseSpace:pTHatMin = 0.15"); // minimos y maximos momentums indicados en el articulo
pythia.readString("PhaseSpace:pTHatMax = 20.");
pythia.init();
//I'll comment the histograms to "filter" the error message of not finding it
//Hist pTZ("dN/dpTZ", 100, 0., 10.); //histograma de momentum
//Hist eta("dN/deta", 1000, -3., 3.); //histograma de pseudorapidez
//comenzamos a analizar eventos
for (int iEvent = 0; iEvent < 10000; ++iEvent)
{
if (!pythia.next()) continue; // sirve para evtar eventos vacios
for (int i = 0; i < pythia.event.size(); ++i) //anaizamos particulas en el eventos
{
/*if (pythia.event[i].isCharged()) //si no es particula intermediay tiene carga
pTZ.fill( pythia.event[i].pT() ); //llenamos el histograma del momentum con los datos
eta.fill( pythia.event[i].eta() ); //llenamos el histograma de la pseudorapidez con los datos
*/}
>// End of event loop. Statistics. Histogram. Done.
}
pythia.stat();
//cout << pTZ; //imprimir histogramas
//cout << eta;
return 0;
}