Dear all,
I have the following piece of code that should extract a 2D histogram (“hJER_per_energy” --> hJER) from a list of files, and perform a fit on the 1D projections of these histograms. I can fit these 1D histograms, and get the constant/mean/sigma values printed. I cannot get the 1D histograms that should be created with the fit.
Below is the macro.
{
// Step 1 - open Root files and retrieve 2D histograms.
TString date = "20150107_had_em_jets"; TString numb = "1000000"; TString suffix = "_13_1_irJ.root"; // Hardest gen jet matched to closest (phi) det jet.
std::vector<TString> filenames;
std::vector<TString> legendEntries;
std::vector<int> colours;
filenames.push_back("LoopRootFiles/" + date + "_Output_JetAnalyzer_radii_GEN_ak3_DET_ak3_margin_0.500000_" + numb + "_Pythia6_Z2star_Default_varyR_CastorTree_MC_7TeV_42X_53XRECOwithCorrector" + suffix);
legendEntries.push_back("(ak3) - (ak3)");
/* Open files */
TFile *_file0 = TFile::Open( filenames[0], "Read");
/* Extract 2D histo */
TH2D *hJER = (TH2D*)_file0->Get("hJER_per_energy");
hJER->FitSlicesY(0,0,-1,10,"");
hJER->Draw("colz");
hJER_1->Draw();
}
The last line results in error:
[color=#BF0000]Error: Symbol hJER_1 is not defined in current scope (tmpfile):1:
Error: Failed to evaluate hJER_1->Draw()
*** Interpreter error recovered ***[/color]
If I add
before drawing hJER_1, I get:
[color=#BF0000]Error: illegal pointer to class object hJER_1 0x0 1390 (tmpfile):1:
*** Interpreter error recovered ***[/color]
Could you please share your insights in this problem? Thanks!
Alex