// read root file from new b1pi analysis generated by // -PPLUGINS=b1pi_hists,monitoring_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("Photon"); TH1I* g_p = (TH1I*)Photons->Get("Momentum"); TH1I* g_theta = (TH1I*)Photons->Get("Theta"); TH1I* g_phi = (TH1I*)Photons->Get("Phi"); TH2I* g_p_vs_theta = (TH2I*)Photons->Get("PVsTheta"); g_p_vs_theta->GetYaxis()->SetRangeUser(0.,3.); // reconstructed pi- TDirectoryFile *pim = (TDirectoryFile*)Part_kin->Get("Pi-"); TH1I* pim_p = (TH1I*)pim->Get("Momentum"); TH1I* pim_theta = (TH1I*)pim->Get("Theta"); TH1I* pim_phi = (TH1I*)pim->Get("Phi"); TH1I* pim_vertex = (TH1I*)pim->Get("VertexZ"); TH2I* pim_p_vs_theta = (TH2I*)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+"); TH1I* pip_p = (TH1I*)pip->Get("Momentum"); TH1I* pip_theta = (TH1I*)pip->Get("Theta"); TH1I* pip_phi = (TH1I*)pip->Get("Phi"); TH1I* pip_vertex = (TH1I*)pip->Get("VertexZ"); TH2I* pip_p_vs_theta = (TH2I*)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"); TH1I* prot_p = (TH1I*)prot->Get("Momentum"); TH1I* prot_theta = (TH1I*)prot->Get("Theta"); TH1I* prot_phi = (TH1I*)prot->Get("Phi"); TH1I* prot_vertex = (TH1I*)prot->Get("VertexZ"); TH2I* prot_p_vs_theta = (TH2I*)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("Photon"); TH1I* g_p_gen = (TH1I*)Photons_gen->Get("Momentum"); TH1I* g_theta_gen = (TH1I*)Photons_gen->Get("Theta"); TH1I* g_phi_gen = (TH1I*)Photons_gen->Get("Phi"); TH2I* g_p_vs_theta_gen = (TH2I*)Photons_gen->Get("PVsTheta"); g_p_vs_theta_gen->GetYaxis()->SetRangeUser(0.,3.); // reconstructed pi- TDirectoryFile *pim_gen = (TDirectoryFile*)Part_gen->Get("Pi-"); TH1I* pim_p_gen = (TH1I*)pim_gen->Get("Momentum"); TH1I* pim_theta_gen = (TH1I*)pim_gen->Get("Theta"); TH1I* pim_phi_gen = (TH1I*)pim_gen->Get("Phi"); TH2I* pim_p_vs_theta_gen = (TH2I*)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+"); TH1I* pip_p_gen = (TH1I*)pip_gen->Get("Momentum"); TH1I* pip_theta_gen = (TH1I*)pip_gen->Get("Theta"); TH1I* pip_phi_gen = (TH1I*)pip_gen->Get("Phi"); TH2I* pip_p_vs_theta_gen = (TH2I*)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"); TH1I* prot_p_gen = (TH1I*)prot_gen->Get("Momentum"); TH1I* prot_theta_gen = (TH1I*)prot_gen->Get("Theta"); TH1I* prot_phi_gen = (TH1I*)prot_gen->Get("Phi"); TH2I* prot_p_vs_theta_gen = (TH2I*)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_PostKinFit"); TH1I *pi0_mass = (TH1I*)pi0mass->Get("InvariantMass"); TDirectoryFile *omegamass = (TDirectoryFile*)b1pi->Get("Hist_InvariantMass_omega_PostKinFit"); TH1I *omega_mass = (TH1I*)omegamass->Get("InvariantMass"); TDirectoryFile *b1mass = (TDirectoryFile*)b1pi->Get("Custom_HistMass_b1_1235"); TH1I *b1_mass = (TH1I*)b1mass->Get("InvariantMass"); TDirectoryFile *xmass = (TDirectoryFile*)b1pi->Get("Custom_HistMass_X_2000"); TH1I *x_mass = (TH1I*)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); }