I’m very new to ROOT and I have a small issue with MakeClass.
I have a multitude of Tchains they all have the same Ttrees (same name but different content of course). So I use MakeClass on one of the Tchains to produce the .C and .h files and I wanted to know if there is a way to modify the .C and .h files so that I can loop over all the different Tchains. In other words, I want to go to the first Tchain plot the content of a certain variable (Leaf) into a Histogram then go to the next Tchain plot the variable of interest again etc …
Thank you,
// load the MakeClass generated source code once
.L MyClass.C
TChain *t; // define a pointer which will keep the "current" chain
MyClass *p; // define a pointer which will keep the "current" analysis
// the sequence below can be repeated many times for different chains
t = new TChain("MyTree"); // create the "current" chain
t->Add("MyFiles*.root"); // add all required files to the "current" chain
p = new MyClass(t); // create the analysis object for the "current" chain
p->Loop(); // loop over all "current" chain's entries
delete p; // no longer needed
delete t; // no longer needed
I have one issue now which is that when I try to write this in a script and run it all at once I don’t know how to include the first line too: “.L MyClass.C” . I’m sorry if this is a stupid question.