I have on /afs/cern.ch/user/b/boeriu/public/ 2 root files and the MakeClass output from chaining them (test.C and test.h). I can’t get any histogram to appear when loading the test.C and looping over all events. If I use only one file to create test.C and .h then I get the histogram to appear, however I need to chain a lot of files for my analysis.
The way I created test.C and .h is this:
root [0] TChain* chain = new TChain(“RootNtupleMaker”);
root [0] chain->Add(“ZmumuJets_Pt15x20ChNtuple_2.root”);
root [0] chain->Add(“ZmumuJets_Pt15x20ChNtuple_8.root”);
root [0] RootNtupleMaker->MakeClass(“test”);
Then I quit root, edit test.C and try in root again:
.L test.C ;
test t
test.Loop();
I have tried as well to re-chain everything in root and then do
test.Loop(chain) - it didn’t work any better. Is there something else I need to do before looping over the events?
Usually I replace the follwoing lines in .h (here my class name is qstar)
qstar::qstar(TTree tree)
{
//if parameter tree is not specified (or zero), connect the file
//used to generate this class and read the Tree.
if (tree == 0) {
TFile f = (TFile)gROOT->GetListOfFiles()->FindObject(“qstar.root”);
if (!f) {
f = new TFile(“qstar.root”);
}
tree = (TTree)gDirectory->Get(“h101”);
}
Init(tree);
}
By
=================
qstar::qstar()
{
// if parameter tree is not specified (or zero), connect the file
// used to generate this class and read the Tree.
TChain *chain = new TChain(“h101”); //<–h101 is tree name
//chain->SetMakeClass(1);
for (Int_t ifil_os= 0; ifil_os <13; ifil_os++) {
Thank you for your reply, I have made the changes, but I get the same result, no histograms (empty or filled) are created. Is there something I need to change in the .C file as well?
I can compile it, I can load .so, but test.so p gives the error:
Error: Symbol test is not defined in current scope (tmpfile):1:
Error: Failed to evaluate test.sop
*** Interpreter error recovered ***
I have done as well .L test.C++ to compile it, all I see in root is this:
Info in TUnixSystem::ACLiC: creating shared library /localscratch2/oana/CMSSW_1_6_12/src/Leptoquark/RootNtupleMaker/test/./test_C.so
In file included from /localscratch2/oana/CMSSW_1_6_12/src/Leptoquark/RootNtupleMaker/test/./test.C:2,
from /localscratch2/oana/CMSSW_1_6_12/src/Leptoquark/RootNtupleMaker/test/./filehPIKQW.h:32,
from /localscratch2/oana/CMSSW_1_6_12/src/Leptoquark/RootNtupleMaker/test/./filehPIKQW.cxx:16:
/localscratch2/oana/CMSSW_1_6_12/src/Leptoquark/RootNtupleMaker/test/./test.h:424: warning: unused parameter ‘entry’
I’ll just go line by line and compare it to your .h file, because I don’t know what else to do, it doesn’t give me any error from compiling it, so I can’t see what’s the difference and why it doesn’t work. The moment I add a chain it totally ignores whatever I have inside the .C file, it doesn’t create the histograms at all.
Is there a way to merge the files in root so I bypass the chain step? Maybe that will save me some time…
I have tried it, it didn’t create the histogram. Even if I want to fill it with just a number that is not given by anything inside my root files, it still doesn’t get created.
I have taken your example and compared line by line, I think it got changed in all the right places, but unfortunately it just refuses to create histograms when I use chain. It does print things out from the loop, but it never creates any histograms.
On afs/cern.ch/user/b/boeriu/public I have 2 root ntuples, plus test.C and test.h which were created by MakeClass after I chained them. Please if possible copy them and see if in root they create a histogram or just the RootNtupleMaker tree. I just get the tree, no histogram. If however I create .C and .h from just ONE single file and loop over that file (or any other one, but just one, not several) then I get the histogram out.
Sushil was recommending changing inside the .h file, I have done those changes as well (see example.C and example.h in public), but unfortunately it doesn’t create any histogram either…
I’m sure I must be nissing something there, but I can’t see what.