Hi again,
I just added :
TH1F *hbsmass; to RecInfo.h as a public data member
I initialized it in the Init() method:
hbsmass = new TH1F(“hbsmass”, “Mass”, 50, 5.1, 5.6);
Then in run(), at the end, I tried to plot it:
recInfo.hbsmass->Draw();
I get no errors, but the histogram does not appear, I think it’s the issue of scope? How do I keep the histograms in scope?
A side-question I have is how do I create arrays of histograms? I saw Rene’s post, that one way is:
TH1F** array = new TH1F*[nhist];
for (int i=0;i<nhist;i++) {
array[i] = new TH1F(Form(“h%d”,i),“test”,100,-3,3);
}
But, when I try this (in the global approach, at the top of RecInfo.C), I get the errors:
Info in TUnixSystem::ACLiC: creating shared library /home/sblusk/anal/root_test/./run_C.so
Error: Missing one of ‘,)’ expected at or after line 15.
Error: Unexpected end of file (G__fgetstream_template():2) RecInfo.C:2:
Error: Missing one of ‘,;{(’ expected at or after line 2.
Error: Unexpected end of file (G__fgetstream_template():2) RecInfo.C:2:
Error: Missing one of ‘{’ expected at or after line 2.
Error: Unexpected end of file (G__fignorestream():3) RecInfo.C:2:
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing /home/sblusk/anal/root_test/./filetqkHxq.cxx /home/sblusk/anal/root_test/./filetqkHxq.h !!!
Error: rootcint: error loading headers…
Error in : Dictionary generation failed!
Info in : Invoking compiler to check macro’s validity
In file included from /home/sblusk/anal/root_test/./run.C:9:
/home/sblusk/anal/root_test/./RecInfo.C:15: error: expected unqualified-id before “for”
/home/sblusk/anal/root_test/./RecInfo.C:15: error: expected constructor, destructor, or type conversion before ‘<’ token
/home/sblusk/anal/root_test/./RecInfo.C:15: error: expected constructor, destructor, or type conversion before ‘++’ token
/home/sblusk/anal/root_test/./RecInfo.h:805: warning: unused parameter ‘entry’
/home/sblusk/anal/root_test/./GenInfo.h:168: warning: unused parameter 'entry’
Error: Function run() is not defined in current scope :0:
*** Interpreter error recovered ***
I like the array approach, since I can then fill the histograms using an index quite easily…