I''m trying to find my steps with ROOT. I've been trying to make a Class with no results. Look what I have done till now:

sophoclestsakiropoulos@MacBook-Air-Sophocles ~ % cd download/ #where I keep my .root filessophoclestsakiropoulos@MacBook-Air-Sophocles download % root -l analysis_1.root #the file with the tree
Attaching file analysis_1.root as _file1…
(TFile ) 0x129fbffd0
root [10] TFile f = new TFile(“analysis_1.root”);
root [11] f->ls();
TFile
analysis_1.root
TFile
analysis_1.root
KEY: TDirectoryFile mainNtuplizer;1 mainNtuplizer
root [12] mainNtuplizer->cd();
root [13] .ls
TDirectoryFile* mainNtuplizer mainNtuplizer
KEY: TTree data;1 Event Summary. #data is the treeee
KEY: TH1F nevents;1
KEY: TH1F n_negevents;1
KEY: TH1F n_posevents;1
KEY: TH1F pileup;1
KEY: TH1F pileuptrue;1
KEY: TH1F sumWeights;1
KEY: TH1F sumScaleWeights;1
KEY: TH1F sumPdfWeights;1
KEY: TH1F sumAlphasWeights;1
KEY: TH2F BTaggingEff_Denom_b;1
KEY: TH2F BTaggingEff_Denom_c;1
KEY: TH2F BTaggingEff_Denom_udsg;1
KEY: TH2F LooseBTaggingEff_Num_b;1
KEY: TH2F LooseBTaggingEff_Num_c;1
KEY: TH2F LooseBTaggingEff_Num_udsg;1
KEY: TH2F MediumBTaggingEff_Num_b;1
KEY: TH2F MediumBTaggingEff_Num_c;1
KEY: TH2F MediumBTaggingEff_Num_udsg;1
KEY: TH2F TightBTaggingEff_Num_b;1
KEY: TH2F TightBTaggingEff_Num_c;1
KEY: TH2F TightBTaggingEff_Num_udsg;1
KEY: TH1F metFilter;1

The next I do is this:
root [16] data->MakeClass(“MyClass”);
ROOT_prompt_16:1:1: error: reference to overloaded function could not be resolved; did you mean to call it?
^~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk/usr/include/c++/v1/__iterator/data.h:27:6: note: possible target for call auto data(_Cont& __c)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk/usr/include/c++/v1/__iterator/data.h:34:6: note: possible target for call auto data(const _Cont& __c)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk/usr/include/c++/v1/__iterator/data.h:41:16: note: possible target for call constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk/usr/include/c++/v1/__iterator/data.h:45:22: note: possible target for call constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }

Please I need some guidance… explain me how to make it run simple! Feel free even to email me I’m a 3 days old phd candidate and I already feel lost. Thanks in advance.

Hi Sophocles,

Thanks for the post and welcome to the ROOT community!
No panic. I have three questions which can help move forward:

  • Is your local root installation working fine besides this problem?
  • Can you try to invoke MakeClass on your tree on a machine where a ROOT installation which is working well can be found? For example a development portal at the institute or lxplus at CERN.
  • Can you share your file with us?

Cheers,
Danilo

1 Like

Good morning! So far root is working fine. I made a link where you can download the file(WeTransfer) called “analysis_1.root” cause it’s more than 3MB. Thanks for the help!!!
we.tl/t-FtA7R1Oq7j

Sophocles, I cannot download anything: can you confirm the url?

Cheers,
D

1 Like

that’s the new url to download the file

Because of std::data using data as a variable name is no longer supported on the prompt.
So to retrieve the TTree named data use:

auto datatree = f->Get<TTree>("data");

Cheers,
Philippe.

2 Likes

That was actually very helpfull! data is inside “mainNtuplizer” so I had to add the folder but you really helped me a lot! Thank you.