Hello everyone,
everytime I try to use TMath or TGraph by “include<TMath.h>” the compiler can’t find this package:
ezaldivar@xxxx:~$ g++ -o tarea4 ./tarea4_1.C
./tarea4_1.C:1:10: fatal error: TMath.h: No such file or directory
1 | #include <TMath.h>
| ^~~~~~~~~
compilation terminated.
I am running root 6.14/02 on a ubuntu 20.04.2 on WSL, and I had a lot of trouble with the installation. I wonder if there lies the problem.
Cheers,
Emiliano.
`root-config --cxx --cflags` -o tarea4 tarea4_1.C `root-config --libs`
hello! could you elaborate on that please? I ran the commands as they are and following appeared:
./tarea4_1.C: In function ‘void tarea4_1()’:
./tarea4_1.C:8:1: error: ‘TFile’ was not declared in this scope
8 | TFile *file = TFile::Open("$PATH/tdscaler_run009776_00692.root");
| ^~~~~
./tarea4_1.C:8:8: error: ‘file’ was not declared in this scope
8 | TFile *file = TFile::Open("$PATH/tdscaler_run009776_00692.root");
| ^~~~
./tarea4_1.C:8:15: error: ‘TFile’ is not a class, namespace, or enumeration
8 | TFile *file = TFile::Open("$PATH/tdscaler_run009776_00692.root");
| ^~~~~
./tarea4_1.C:9:1: error: ‘TTree’ was not declared in this scope
9 | TTree *arbol = (TTree*) file->Get("XCDF");
| ^~~~~
./tarea4_1.C:9:8: error: ‘arbol’ was not declared in this scope
9 | TTree *arbol = (TTree*) file->Get("XCDF");
| ^~~~~
./tarea4_1.C:9:23: error: expected primary-expression before ‘)’ token
9 | TTree *arbol = (TTree*) file->Get("XCDF");
The program I’m trying to run looks like this:
#include <TMath.h>
#include <iostream>
using namespace std;
void tarea4_1()
{
TFile *file = TFile::Open("$PATH/tdscaler_run009776_00692.root");
TTree *arbol = (TTree*) file->Get("XCDF");
Int_t entradas = arbol->GetEntries();
Int_t Canales = 1200;
UInt_t channelIDInfo[Canales];
arbol->SetBranchAddress("scaler.channelID", channelIDInfo);
cout << "looping..." << endl;
for(Int_t i=0; i<entradas; i++)
{
arbol->GetEntry(i);
}
}
I see TMath.h is present on ~rootbuild/include
, but I wouldn’t know how to tell the compiler that it is there. Very appreciated anyways.
Cheers,
Emiliano.
Obviously, missing :
#include "TFile.h"
#include "TTree.h"