ANASEN_analysis/Armory/testMacro.C
2026-09-21 11:33:59 -04:00

54 lines
1.7 KiB
C

{
TFile *file0 = TFile::Open("SimAnasen1.root");
file0->ls();
TTree *tree1 = (TTree*)(file0->Get("tree1"));
new TBrowser();
/*
new TCanvas();
TH2F *h3 = new TH2F(
"hExReconVsVZ",
"Ex_recon vs vZ;vZ (mm);Excitation energy (MeV)",
100, 0, 0,
100, -1, 0
);
tree1->Draw("Ex_recon:vZ>>hExReconVsVZ", "sx3ID >= 0", "colz");
TH2F *h4 = new TH2F(
"hExVsVZ",
"",
100, 0, 0,
100, -1, 0
);
tree1->Draw("Ex:vZ>>hExVsVZ", "sx3ID >= 0", "box same");*/
/*
new TCanvas();
tree1->Draw("originalEnergy:Tb", "sx3ID >=0", "");
TF1 *f_diagonal = new TF1("f_diagonal", "x", 0, 200); // assuming the range for Tb is 0 to 200
f_diagonal->SetLineColor(kRed);
f_diagonal->SetLineStyle(2);
f_diagonal->Draw("same");*/
/*
TH2F *h5 = new TH2F("Excitation Energy vs vZ", "Excitation Energy vs vZ;vZ (mm);Excitation energy (MeV)", 300, 0, 0, 300, 0, 0); //arguments are (name, title, nbinsX, xlow, xup, nbinsY, ylow, yup)
tree1->Draw("Ex_recon:vZ >> hExReconVsVZ", "sx3ID >= 0", "colz");
tree1->Draw("Ex:vZ >> h5", "sx3ID >= 0 && EPC >= 0.03", "same");
*/
new TCanvas("c1", "Canvas", 900, 600);
tree1->Draw("Ex_recon:vZ_recon>>h2(800,-500,300,110,-1,10)", "sx3ID >=0 && !TMath::IsNaN(vZ_recon)", "colz");
tree1->Draw("Ex:vZ", "sx3ID >=0 && !TMath::IsNaN(vZ_recon)", "same");
c1->SaveAs("Ex_recon.png");
new TCanvas("c2", "Canvas", 900, 600);
tree1->Draw("theta_recon:thetab", "sx3ID >=0 && Esx3 > 0", "");
c2->SaveAs("theta_recon_vs_thetab.png");
new TCanvas("c3", "Canvas", 900, 600);
tree1->Draw("vZ_recon:vZ", "sx3ID >=0 && !TMath::IsNaN(vZ_recon)", "");
TF1 *line = new TF1("line", "x", gPad->GetUxmin(), gPad->GetUxmax());
line->SetLineColor(kRed); line->Draw("SAME");
c3->SaveAs("vZ_recon_vs_vZ.png");
}