Hello,
I have a couple of .root files generated by GEANT4, and I need to normalize the histograms. The normalization factor is a double, which I defined on my code (Simulation_Factor). The question is, what is the easiest way to multiply my histograms so I can have my data normalized? I’m sure this is a trivial question, but sorry to say I’m stuck with it.
This is my code to call the histograms from the .root files:
void Fluorescent_Screens(){
double Simulation_Factor = 6.2e12;
TFile *YAG = new TFile(“build-SIRIUS-Desktop-Default/SIRIUS_YAG_20160120.root”);
TFile *Al2O3 = new TFile(“build-SIRIUS-Desktop-Default/SIRIUS_Cr_Alumina_20160120.root”);
TTree tree1 = (TTree)YAG->Get(“Mirror_Fluence_tuple_fluence_gamma”);
TTree tree2 = (TTree)Al2O3->Get(“Mirror_Fluence_tuple_fluence_gamma”);
tree1->Draw(“kine>>hist1”);
tree2->Draw(“kine>>hist2”);
TH1F *hist1 = gDirectory->Get(“hist1”);
TH1F *hist2 = gDirectory->Get(“hist2”);
TCanvas *c1 = new TCanvas(“c1”);
c1->SetFillColor(10);
c1->SetGrid();
c1->SetLogx();
c1->SetLogy();
hist1->SetTitle(“Fluorescent Screens Comparison”);
hist1->GetXaxis()->SetTitle(“Photon Energy[MeV]”);
hist1->GetYaxis()->SetTitle(“Photon Count”);
hist1->SetLineColor(4);
hist1->SetLineWidth(2);
hist1->Draw();
hist2->SetLineColor(2);
hist2->SetLineWidth(2);
hist2->Draw(“Same”);
leg = new TLegend(0.1,0.7,0.3,0.9);
leg->SetFillColor(0);
leg->AddEntry(hist1,“Ce doped YAG”,“l”);
leg->AddEntry(hist2,“Cr doped Al2O3”,“l”);
leg->Draw();
}
Thanks a lot!
Leonardo.