// read root file from new b1pi analysis generated by // -PPLUGINS=b1pi_hists and create plots from the root file // do be displayed on the web. { TFile *F1 = new TFile("hd_root.root"); TDirectoryFile *Indep = (TDirectoryFile*)F1->Get("Independent"); TDirectoryFile *Part_kin = (TDirectoryFile*)Indep->Get("Hist_DetectedParticleKinematics"); TDirectoryFile *Part_gen = (TDirectoryFile*)Indep->Get("Hist_ThrownParticleKinematics"); // get reconstructed particles: // reconstructed photons TDirectoryFile *Photons = (TDirectoryFile*)Part_kin->Get("Gamma"); TH1D* g_p = (TH1D*)Photons->Get("Momentum"); TH1D* g_theta = (TH1D*)Photons->Get("Theta"); TH1D* g_phi = (TH1D*)Photons->Get("Phi"); TH2D* g_p_vs_theta = (TH2D*)Photons->Get("PVsTheta"); g_p_vs_theta->GetYaxis()->SetRangeUser(0.,3.); // reconstructed pi- TDirectoryFile *pim = (TDirectoryFile*)Part_kin->Get("Pi-"); TH1D* pim_p = (TH1D*)pim->Get("Momentum"); TH1D* pim_theta = (TH1D*)pim->Get("Theta"); TH1D* pim_phi = (TH1D*)pim->Get("Phi"); TH1D* pim_vertex = (TH1D*)pim->Get("VertexZ"); TH2D* pim_p_vs_theta = (TH2D*)pim->Get("PVsTheta"); pim_p_vs_theta->GetYaxis()->SetRangeUser(0.,6.); pim_p_vs_theta->GetXaxis()->SetRangeUser(0.,90.); // reconstructed pi+ TDirectoryFile *pip = (TDirectoryFile*)Part_kin->Get("Pi+"); TH1D* pip_p = (TH1D*)pip->Get("Momentum"); TH1D* pip_theta = (TH1D*)pip->Get("Theta"); TH1D* pip_phi = (TH1D*)pip->Get("Phi"); TH1D* pip_vertex = (TH1D*)pip->Get("VertexZ"); TH2D* pip_p_vs_theta = (TH2D*)pip->Get("PVsTheta"); pip_p_vs_theta->GetYaxis()->SetRangeUser(0.,6.); pip_p_vs_theta->GetXaxis()->SetRangeUser(0.,90.); // reconstructed protons TDirectoryFile *prot = (TDirectoryFile*)Part_kin->Get("Proton"); TH1D* prot_p = (TH1D*)prot->Get("Momentum"); TH1D* prot_theta = (TH1D*)prot->Get("Theta"); TH1D* prot_phi = (TH1D*)prot->Get("Phi"); TH1D* prot_vertex = (TH1D*)prot->Get("VertexZ"); TH2D* prot_p_vs_theta = (TH2D*)prot->Get("PVsTheta"); prot_p_vs_theta->GetYaxis()->SetRangeUser(0.,3.); prot_p_vs_theta->GetXaxis()->SetRangeUser(0.,90.); // get generated particles: // reconstructed photons TDirectoryFile *Photons_gen = (TDirectoryFile*)Part_gen->Get("Gamma"); TH1D* g_p_gen = (TH1D*)Photons_gen->Get("Momentum"); TH1D* g_theta_gen = (TH1D*)Photons_gen->Get("Theta"); TH1D* g_phi_gen = (TH1D*)Photons_gen->Get("Phi"); TH2D* g_p_vs_theta_gen = (TH2D*)Photons_gen->Get("PVsTheta"); g_p_vs_theta_gen->GetYaxis()->SetRangeUser(0.,3.); // reconstructed pi- TDirectoryFile *pim_gen = (TDirectoryFile*)Part_gen->Get("Pi-"); TH1D* pim_p_gen = (TH1D*)pim_gen->Get("Momentum"); TH1D* pim_theta_gen = (TH1D*)pim_gen->Get("Theta"); TH1D* pim_phi_gen = (TH1D*)pim_gen->Get("Phi"); TH2D* pim_p_vs_theta_gen = (TH2D*)pim_gen->Get("PVsTheta"); pim_p_vs_theta_gen->GetYaxis()->SetRangeUser(0.,6.); pim_p_vs_theta_gen->GetXaxis()->SetRangeUser(0.,90.); // reconstructed pi+ TDirectoryFile *pip_gen = (TDirectoryFile*)Part_gen->Get("Pi+"); TH1D* pip_p_gen = (TH1D*)pip_gen->Get("Momentum"); TH1D* pip_theta_gen = (TH1D*)pip_gen->Get("Theta"); TH1D* pip_phi_gen = (TH1D*)pip_gen->Get("Phi"); TH2D* pip_p_vs_theta_gen = (TH2D*)pip_gen->Get("PVsTheta"); pip_p_vs_theta_gen->GetYaxis()->SetRangeUser(0.,6.); pip_p_vs_theta_gen->GetXaxis()->SetRangeUser(0.,90.); // reconstructed protons TDirectoryFile *prot_gen = (TDirectoryFile*)Part_gen->Get("Proton"); TH1D* prot_p_gen = (TH1D*)prot_gen->Get("Momentum"); TH1D* prot_theta_gen = (TH1D*)prot_gen->Get("Theta"); TH1D* prot_phi_gen = (TH1D*)prot_gen->Get("Phi"); TH2D* prot_p_vs_theta_gen = (TH2D*)prot_gen->Get("PVsTheta"); prot_p_vs_theta_gen->GetYaxis()->SetRangeUser(0.,3.); prot_p_vs_theta_gen->GetXaxis()->SetRangeUser(0.,90.); char atr[128] = "standardtest"; char nam[128]; TCanvas * c2 = new TCanvas("c2", "c2", 800, 600); // prepare proton plots prot_p_vs_theta->SetMarkerColor(2); prot_p_vs_theta_gen->Draw(); prot_p_vs_theta->Draw("same"); gPad->SetGrid(); Int_t Egen = prot_p_vs_theta_gen->GetEntries(); Int_t Erec = prot_p_vs_theta->GetEntries(); char text1[128]; sprintf(text1,"Generated Protons %d",Egen); TText *t1 = new TText(30., 2.5,text1); char text2[128]; sprintf(text2,"Reconstructed Protons %d",Erec); Double_t max1 = prot_p_vs_theta->GetMaximum()*0.8; t1 = new TText(30., max1,text1); TText *t2 = new TText(30., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_protons.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_protons.gif",atr); c2->SaveAs(nam); prot_theta->SetLineColor(2); prot_theta_gen->GetXaxis()->SetRangeUser(0.,80.); prot_theta_gen->Draw(); prot_theta->Draw("same"); Egen = prot_theta_gen->GetEntries(); Erec = prot_theta->GetEntries(); sprintf(text1,"Generated Protons %d",Egen); t1 = new TText(80., 250.,text1); sprintf(text2,"Reconstructed Protons %d",Erec); max1 = prot_theta_gen->GetMaximum()*0.8; t1 = new TText(5., max1,text1); t2 = new TText(5., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_protons_theta.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_protons_theta.gif",atr); c2->SaveAs(nam); prot_phi->SetLineColor(2); prot_phi_gen->GetXaxis()->SetRangeUser(-180.,180.); prot_phi_gen->GetYaxis()->SetRangeUser(0.,prot_phi_gen->GetMaximum()*1.2); prot_phi_gen->Draw(); prot_phi->Draw("same"); Egen = prot_phi_gen->GetEntries(); Erec = prot_phi->GetEntries(); sprintf(text1,"Generated Protons %d",Egen); sprintf(text2,"Reconstructed Protons %d",Erec); max1 = prot_phi_gen->GetMaximum()*0.85; t1 = new TText(-50., max1,text1); t2 = new TText(-50., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_protons_phi.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_protons_phi.gif",atr); c2->SaveAs(nam); prot_vertex->Draw(); Erec = prot_vertex->GetEntries(); sprintf(text2,"Reconstructed Protons %d",Erec); max1 = prot_vertex->GetMaximum()*0.85; t2 = new TText(30., max1,text2); t2->Draw(); sprintf(nam,"b1pi_%s_protons_vertex.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_protons_vertex.gif",atr); c2->SaveAs(nam); // prepare photon plots g_p_vs_theta->SetMarkerColor(2); g_p_vs_theta_gen->Draw("box"); g_p_vs_theta->Draw("same box"); gPad->SetGrid(); Egen = g_p_vs_theta_gen->GetEntries(); Erec = g_p_vs_theta->GetEntries(); sprintf(text1,"Generated Photons %d",Egen); sprintf(text2,"Reconstructed Photons %d",Erec); max1 = g_p_vs_theta_gen->GetMaximum()*0.8; t1 = new TText(30., max1,text1); t2 = new TText(30., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_photons.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_photons.gif",atr); c2->SaveAs(nam); g_theta->SetLineColor(2); g_theta->Draw(); g_theta_gen->Draw("same"); Egen = g_theta_gen->GetEntries(); Erec = g_theta->GetEntries(); sprintf(text1,"Generated Photons %d",Egen); sprintf(text2,"Reconstructed Photons %d",Erec); max1 = g_theta->GetMaximum()*0.8; t1 = new TText(60., max1,text1); t2 = new TText(60., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_photons_theta.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_photons_theta.gif",atr); c2->SaveAs(nam); g_theta->GetXaxis()->SetRangeUser(0.,50.); g_theta->Draw(); g_theta_gen->Draw("same"); max1 = g_theta->GetMaximum()*0.8; t1 = new TText(19., max1,text1); t2 = new TText(19., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_photons_theta_zoom.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_photons_theta_zoom.gif",atr); c2->SaveAs(nam); g_phi->SetLineColor(2); g_phi->GetYaxis()->SetRangeUser(0.,g_phi->GetMaximum()*1.2); g_phi->Draw(); g_phi_gen->Draw("same"); Egen = g_phi_gen->GetEntries(); Erec = g_phi->GetEntries(); sprintf(text1,"Generated Photons %d",Egen); sprintf(text2,"Reconstructed Photons %d",Erec); max1 = g_phi->GetMaximum()*0.85; t1 = new TText(-50., max1,text1); t2 = new TText(-50., max1*0.95,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_photons_phi.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_photons_phi.gif",atr); c2->SaveAs(nam); // prepare pi+ plots pip_p_vs_theta->SetMarkerColor(2); pip_p_vs_theta_gen->Draw("box"); pip_p_vs_theta->Draw("same box"); gPad->SetGrid(); Egen = pip_p_vs_theta_gen->GetEntries(); Erec = pip_p_vs_theta->GetEntries(); sprintf(text1,"Generated Pi+ %d",Egen); sprintf(text2,"Reconstructed Pi+ %d",Erec); max1 = pip_p_vs_theta_gen->GetMaximum()*0.8; t1 = new TText(30., max1,text1); t2 = new TText(30., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_piplus.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_piplus.gif",atr); c2->SaveAs(nam); pip_theta->SetLineColor(2); pip_theta_gen->GetXaxis()->SetRangeUser(0.,80.); pip_theta_gen->Draw(); pip_theta->Draw("same"); Egen = pip_theta_gen->GetEntries(); Erec = pip_theta->GetEntries(); sprintf(text1,"Generated Pi+ %d",Egen); sprintf(text2,"Reconstructed Pi+ %d",Erec); t2->SetTextColor(2); max1 = pip_theta_gen->GetMaximum()*0.8; t1 = new TText(30., max1,text1); t2 = new TText(30., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_piplus_theta.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_piplus_theta.gif",atr); c2->SaveAs(nam); pip_phi->SetLineColor(2); pip_phi_gen->GetXaxis()->SetRangeUser(-180.,180.); pip_phi_gen->GetYaxis()->SetRangeUser(0.,pip_phi_gen->GetMaximum()*1.2); pip_phi_gen->Draw(); pip_phi->Draw("same"); Egen = pip_phi_gen->GetEntries(); Erec = pip_phi->GetEntries(); sprintf(text1,"Generated Pi+ %d",Egen); sprintf(text2,"Reconstructed Pi+ %d",Erec); max1 = pip_phi_gen->GetMaximum()*0.85; t1 = new TText(-50., max1,text1); t2 = new TText(-50., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_piplus_phi.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_piplus_phi.gif",atr); c2->SaveAs(nam); pip_vertex->Draw(); Erec = pip_vertex->GetEntries(); sprintf(text2,"Reconstructed Pi+ %d",Erec); max1 = pip_vertex->GetMaximum()*0.85; t2 = new TText(30., max1,text2); t2->Draw(); sprintf(nam,"b1pi_%s_piplus_vertex.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_piplus_vertex.gif",atr); c2->SaveAs(nam); // prepare pi- plots pim_p_vs_theta->SetMarkerColor(2); pim_p_vs_theta_gen->Draw("box"); pim_p_vs_theta->Draw("same box"); gPad->SetGrid(); Egen = pim_p_vs_theta_gen->GetEntries(); Erec = pim_p_vs_theta->GetEntries(); sprintf(text1,"Generated Pi- %d",Egen); sprintf(text2,"Reconstructed Pi- %d",Erec); max1 = pim_p_vs_theta_gen->GetMaximum()*0.8; t1 = new TText(30., max1,text1); t2 = new TText(30., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_piminus.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_piminus.gif",atr); c2->SaveAs(nam); pim_theta->SetLineColor(2); pim_theta_gen->GetXaxis()->SetRangeUser(0.,80.); pim_theta_gen->Draw(); pim_theta->Draw("same"); Egen = pim_theta_gen->GetEntries(); Erec = pim_theta->GetEntries(); sprintf(text1,"Generated Pi- %d",Egen); sprintf(text2,"Reconstructed Pi- %d",Erec); t2->SetTextColor(2); max1 = pim_theta_gen->GetMaximum()*0.8; t1 = new TText(30., max1,text1); t2 = new TText(30., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_piminus_theta.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_piminus_theta.gif",atr); c2->SaveAs(nam); pim_phi->SetLineColor(2); pim_phi_gen->GetXaxis()->SetRangeUser(-180.,180.); pim_phi_gen->GetYaxis()->SetRangeUser(0.,pim_phi_gen->GetMaximum()*1.2); pim_phi_gen->Draw(); pim_phi->Draw("same"); Egen = pim_phi_gen->GetEntries(); Erec = pim_phi->GetEntries(); sprintf(text1,"Generated Pi- %d",Egen); sprintf(text2,"Reconstructed Pi- %d",Erec); max1 = pim_phi_gen->GetMaximum()*0.85; t1 = new TText(-50., max1,text1); t2 = new TText(-50., max1*0.9,text2); t2->SetTextColor(2); t1->Draw(); t2->Draw(); sprintf(nam,"b1pi_%s_piminus_phi.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_piminus_phi.gif",atr); c2->SaveAs(nam); pim_vertex->Draw(); Erec = pim_vertex->GetEntries(); sprintf(text2,"Reconstructed Pi- %d",Erec); max1 = pim_vertex->GetMaximum()*0.85; t2 = new TText(30., max1,text2); t2->Draw(); sprintf(nam,"b1pi_%s_piminus_vertex.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_piminus_vertex.gif",atr); c2->SaveAs(nam); // now make plots for invariant mass spectra TDirectoryFile *b1pi = (TDirectoryFile*)F1->Get("b1pi"); //TDirectoryFile *pi0mass = (TDirectoryFile*)b1pi->Get("Hist_InvariantMass_Pi0_PostKinFitConLev"); TDirectoryFile *pi0mass = (TDirectoryFile*)b1pi->Get("Hist_InvariantMass_Pi0_PostPID"); TH1D *pi0_mass = (TH1D*)pi0mass->Get("InvariantMass"); //TDirectoryFile *omegamass = (TDirectoryFile*)b1pi->Get("Hist_InvariantMass_omega_PostKinFitConLev_KinFit"); TDirectoryFile *omegamass = (TDirectoryFile*)b1pi->Get("Hist_InvariantMass_omega_PostPID"); TH1D *omega_mass = (TH1D*)omegamass->Get("InvariantMass"); //TDirectoryFile *b1mass = (TDirectoryFile*)b1pi->Get("Hist_InvariantMass_b1(1235)+_PostKinFitConLev_KinFit"); TDirectoryFile *b1mass = (TDirectoryFile*)b1pi->Get("Hist_InvariantMass_b1(1235)+_PostPID"); TH1D *b1_mass = (TH1D*)b1mass->Get("InvariantMass"); //TDirectoryFile *xmass = (TDirectoryFile*)b1pi->Get("Hist_InvariantMass_X(2000)_PostKinFitConLev_KinFit"); TDirectoryFile *xmass = (TDirectoryFile*)b1pi->Get("Hist_InvariantMass_X(2000)_PostPID"); TH1D *x_mass = (TH1D*)xmass->Get("InvariantMass"); Erec = pi0_mass->GetEntries(); max1 = pi0_mass->GetMaximum()*1.5; pi0_mass->GetYaxis()->SetRangeUser(0.,max1); pi0_mass->Draw(); max1 *=0.8; sprintf(text2,"Reconstructed Pi0 %d",Erec); t2 = new TText(0.2, max1*0.95,text2); t2->SetTextColor(2); t2->Draw(); sprintf(nam,"b1pi_%s_pi0Mass.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_pi0Mass.gif",atr); c2->SaveAs(nam); Erec = omega_mass->GetEntries(); max1 = omega_mass->GetMaximum()*1.5; omega_mass->GetYaxis()->SetRangeUser(0.,max1); omega_mass->Draw(); max1 *=0.8; sprintf(text2,"Reconstructed #omega %d",Erec); t2 = new TText(0.3, max1*1.1,text2); t2->SetTextColor(2); t2->Draw(); sprintf(nam,"b1pi_%s_omegaMass.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_omegaMass.gif",atr); c2->SaveAs(nam); Erec = b1_mass->GetEntries(); max1 = b1_mass->GetMaximum()*1.5; b1_mass->GetYaxis()->SetRangeUser(0.,max1); b1_mass->Draw(); max1 *=0.8; sprintf(text2,"Reconstructed b1(1235) %d",Erec); t2 = new TText(0.7, max1*1.1,text2); t2->SetTextColor(2); t2->Draw(); sprintf(nam,"b1pi_%s_b1Mass.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_b1Mass.gif",atr); c2->SaveAs(nam); Erec = x_mass->GetEntries(); max1 = x_mass->GetMaximum()*1.5; x_mass->GetYaxis()->SetRangeUser(0.,max1); x_mass->Draw(); max1 *=0.8; sprintf(text2,"Reconstructed X(2000) %d",Erec); t2 = new TText(1.2, max1*1.1,text2); t2->SetTextColor(2); t2->Draw(); sprintf(nam,"b1pi_%s_XMass.pdf",atr); c2->SaveAs(nam); sprintf(nam,"b1pi_%s_XMass.gif",atr); c2->SaveAs(nam); }