Use of gDirectory->get() with ACLIC

Hi,

I made a little program with root and it worked pretty well when I used the interpreter like that :
root [] .L tree_v3.C

But, I want to use root with the Boost c++ library and I read somewhere that it is better to use the compiler ACLIC if I want to make it work :
root [] .L tree_v3.C+

However, I have those lines in my code :

tree->Draw("TIME>>htemp1(" + str_nombre_de_bins + ",1.0e8,1.0e+9)","TIME>100e6 && COOR_Y>-4 && COOR_Z<60 && COOR_Z>50","", 882822, 0);
TH1F *htemp1 = (TH1F*)gDirectory->Get("htemp1");

tree->Draw("TIME>>htemp2(" + str_nombre_de_bins + ",1.0e8,1.0e+9)","TIME>100e6 && COOR_Y>-4 && COOR_Z<130 && COOR_Z>120","", 882822, 0);
TH1F *htemp2 = (TH1F*)gDirectory->Get("htemp2");

And when I compiled my code, I got this error :

In file included from input_line_11:9:
././tree_v3.C:82:24: error: use of undeclared identifier 'gDirectory'
        TH1F *htemp1 = (TH1F*)gDirectory->Get("htemp1");
                              ^
././tree_v3.C:85:24: error: use of undeclared identifier 'gDirectory'
        TH1F *htemp2 = (TH1F*)gDirectory->Get("htemp2");
                              ^

Is it an issue from the fact that I use ACLIC ?
Do you know how to fix it ?

Regards,
William

have you #include TDirectory.h ?

2 Likes

Hi,

No I hadn’t…
So now it works when I include the library, thank you so much for helping me so quickly !

Regards,
William

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.