Hi all
I have two root files file1.root , file2.root “they are in attachment” and each file contains one ntuple “data”
and I create a chain with the with the following statement
[code]TChain chain("data");
chain .Add("file1.root");
chain.Add("file2.root");
chain.Draw("Ei")
Error in <TTreeFormula::Compile>: Bad numerical expression : "Ei"[/code]
what is the problem ?
and the second thing How can I plot many histogram in one macrofile and read file1.root ,file2.root together like that
Hi ,
It is not work root [12] hadd -h out.root file1.root file2.root
Error: Symbol hadd is not defined in current scope (tmpfile):1:
Error: Invalid type 'h' in declaration of 'out' (tmpfile):1:
Error: Invalid type 'h' in declaration of 'out' (tmpfile):1:
Error: Invalid type 'h' in declaration of 'out' (tmpfile):1:
Error: Invalid type 'h' in declaration of 'out' (tmpfile):1:
Error: Symbol h out is not defined in current scope (tmpfile):1:
Error: Failed to evaluate h out.root file1
Error: Failed to evaluate h out.root file1.root file2
Error: Failed to evaluate h out.root file1.root file2.root
(const int)0
what is the problem?
You need to distinguish the command prompt (e.g. bash) from the ROOT prompt. “hadd” is a binary program that comes bundled with ROOT, but it’s not a command inside ROOT itself. The binary should live at $ROOTSYS/bin/hadd.
As to your original post, the “Bad numerical expression: Ei” is probably because there is no such branch in your TTrees. Try looking at your TChain using a TBrowser, or do TChain.Print() to see the list of branches. I’m betting there isn’t one called “Ei”. The name needs to match exactly for TChain::Draw to work.
Hi all,
I try another branch and I still have the same problem
TChain chain("data")
root [3] chain.Add("file1.root")
(Int_t)1
root [4] chain.Add("file2.root")
(Int_t)1
root [5] chain.Draw("Ap")
Error in <TTreeFormula::Compile>: Bad numerical expression : "Ap"
root [6] TChain.Print()
Error: Symbol TChain is not defined in current scope (tmpfile):1:
Error: Failed to evaluate TChain.Print()
If you choose to use hadd, you have to do it in your bash terminal (or other), not in the ROOT prompt
Note I wrote a mistake previously, the “-h” option does not exist
You should type (in a “classic” terminal)