void view_module(TString runNumber, Int_t iBar, Int_t iSide) { TString inDir = "/Volumes/Data/kresan/s438b/data/"; const Int_t fNofPMTs = 800; TString fileName = inDir + runNumber + "_raw_land.root"; TFile *file = new TFile(fileName); char str[100]; Int_t index = (Double_t)fNofPMTs / 2. * (iSide - 1) + iBar - 1; sprintf(str, "hTime_%d", index); TH1F *h1 = (TH1F*) file->Get(str); TPstyle(); Style(h1, "TAC channel", "Time (ns)"); h1->GetYaxis()->SetNdivisions(510); TCanvas *c1 = new TCanvas("c1", "", 10, 10, 500, 500); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.05); h1->Draw(); sprintf(str, "Bar: %3d, Side: %d", iBar, iSide); TPaveText *t1 = new TPaveText(0.192, 0.780, 0.623, 0.875, "NDC"); t1->AddText(str); Style(t1); t1->Draw(); }
// ----------------------------------------------------------------------------- void plot_minv_astro() { TPstyle(); TFile *file_1n = new TFile("r3breco.600AMeV.1n.100keV.35m.root"); TH1F *h_minv_1n = (TH1F*) file_1n->Get("Minv"); Style(h_minv_1n, "E_{rel} (MeV)", "events"); h_minv_1n->SetLineColor(1); h_minv_1n->GetXaxis()->SetRangeUser(0., 0.5); h_minv_1n->GetYaxis()->SetTitleOffset(1.6); TF1 *f1 = new TF1("f1", "gaus", 0.07, 0.13); f1->FixParameter(1, 0.1); h_minv_1n->Fit(f1, "QNR"); gStyle->SetPaperSize(16, 16); TCanvas *c1 = new TCanvas("c1", "", 0, 0, 900, 450); TPostScript *ps1 = new TPostScript("minv_astro.eps", -113); ps1->Range(16, 16); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.05); gPad->SetTickx(); gPad->SetTicky(); h_minv_1n->Draw(); f1->Draw("same"); char strT[100]; sprintf(strT, "#sigma = %2.0f keV", f1->GetParameter(2)*1000.); TPaveLabel *l1 = new TPaveLabel(0.527, 0.782, 0.919, 0.851, strT, "NDC"); Style(l1); l1->Draw(); ps1->Close(); }
// ----------------------------------------------------------------------------- void plot_minv_tn_compare() { TPstyle(); TFile *file_4n = new TFile("r3breco.600AMeV.4n.100keV.35m.root"); TH1F *h_minv_4n = (TH1F*) file_4n->Get("Minv"); Style(h_minv_4n, "E_{rel} (MeV)", "events"); h_minv_4n->SetLineColor(4); // h_minv_4n->Rebin(2); h_minv_4n->GetXaxis()->SetRangeUser(0., 0.5); // h_minv_4n->GetYaxis()->SetRangeUser(0., 1000.); TFile *file_4n_o = new TFile("r3breco.600AMeV.4n.100keV.35m.old.root"); TH1F *h_minv_4n_o = (TH1F*) file_4n_o->Get("Minv"); h_minv_4n_o->SetLineColor(2); // TF1 *f1 = new TF1("f1", "gaus", 0.1 - 3*0.035, 0.1 + 2*0.035); // f1->FixParameter(1, 0.1); // h_minv_4n->Fit(f1, "NR+"); // cout << f1->GetParameter(1) << " +- " << f1->GetParError(1) << endl; // cout << f1->GetParameter(2) << " +- " << f1->GetParError(2) << endl; // TF1 *f2 = new TF1("f2", "[0]*exp(-[1]*x)", 0.1 + 2*0.035, 1.); // f2->SetLineColor(4); // h_minv_4n->Fit(f2, "NR+"); // cout << f2->GetParameter(0) << " +- " << f2->GetParError(0) << endl; gStyle->SetPaperSize(16, 16); TCanvas *c1 = new TCanvas("c1", "", 0, 0, 900, 450); TPostScript *ps1 = new TPostScript("minv_tetra-neutron_compare.eps", -113); ps1->Range(16, 16); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.05); gPad->SetTickx(); gPad->SetTicky(); h_minv_4n->Draw(); h_minv_4n_o->Draw("same"); // f1->Draw("same"); // f2->Draw("same"); // char strT[100]; // sprintf(strT, "#sigma = %2.0f keV", f1->GetParameter(2)*1000.); // TPaveLabel *l1 = new TPaveLabel(0.303, 0.667, 0.693, 0.733, strT, "NDC"); // Style(l1); // l1->SetTextColor(2); // l1->Draw(); // TPaveLabel *l2 = new TPaveLabel(0.462, 0.795, 0.915, 0.868, "tetra-neutron", "NDC"); // Style(l2); // l2->Draw(); // sprintf(strT, "exp(-%3.2fx)", f2->GetParameter(1)); // TPaveLabel *l3 = new TPaveLabel(0.507, 0.335, 0.897, 0.401, strT, "NDC"); // Style(l3); // l3->SetTextColor(4); // l3->Draw(); // cout << h_minv_4n->Integral() << endl; // cout << 100.*h_minv_4n->Integral(TMath::Nint((0.1 - 3*0.035 + 0.01)/0.01)+1, // TMath::Nint((0.1 + 2*0.035 + 0.01)/0.01)+1) / // h_minv_4n->Integral() << endl; ps1->Close(); }
void plot_paddle() { TPstyle(); TString names[] = {"/Users/kresan/neuland/r3bcalibr.s406.255AMeV.root", "/Users/kresan/neuland/r3bcalibr.s406.498AMeV.root", "/Users/kresan/neuland/r3bcalibr.s406.799AMeV.root", "/Users/kresan/neuland/r3bcalibr.s406.1014AMeV.root", "/Users/kresan/neuland/r3bcalibr.s406.1500AMeV.root" }; TString en[] = {"255 AMeV", "498 AMeV", "799 AMeV", "1014 AMeV", "1500 AMeV"}; TString eno[] = {"_255", "_498", "_799", "_1014", "_1500"}; TFile *file[5]; TH1F *h1[5]; TH1F *hm[5]; Double_t nev[5]; Double_t binsize; for(Int_t i = 0; i < 5; i++) { file[i] = new TFile(names[i]); h1[i] = (TH1F*) file[i]->Get("PaddleEnergy"); hm[i] = (TH1F*) file[i]->Get("Multiplicity1"); nev[i] = hm[i]->Integral(2, hm[i]->GetXaxis()->GetNbins()); if(0 == i) { binsize = (Double_t)(h1[i]->GetXaxis()->GetXmax() - h1[i]->GetXaxis()->GetXmin()) / (Double_t)h1[i]->GetXaxis()->GetNbins(); } h1[i]->Scale(1./binsize); h1[i]->SetLineColor(i+1); h1[i]->Scale(1./nev[i]); cout << "Unity test " << i << " value: " << h1[i]->Integral(1, h1[i]->GetXaxis()->GetNbins()) << endl; } cout << binsize << " MeV" << endl; Style(h1[4], "Energy per paddle (MeV)", "probability #times N_{mean}"); h1[4]->SetLineColor(6); // h1[4]->Scale(2.2); TFile *ifile = new TFile("data/all_histos.root"); TH1F *himult[4]; TH1F *hien[4]; TString ien[] = {"300", "500", "800", "1500"}; Double_t inev[4]; for(Int_t i = 0; i < 4; i++) { himult[i] = (TH1F*) ifile->Get((TString("hMulti")+ien[i]).Data()); hien[i] = (TH1F*) ifile->Get((TString("hEnergy")+ien[i]).Data()); inev[i] = himult[i]->Integral(2, himult[i]->GetXaxis()->GetNbins()); hien[i]->Sumw2(); hien[i]->Scale(1./binsize); hien[i]->Scale(1./inev[i]); hien[i]->SetMarkerStyle(24); cout << inev[i] << endl; } hien[0]->SetLineColor(1); hien[1]->SetLineColor(2); hien[2]->SetLineColor(3); hien[3]->SetLineColor(6); hien[0]->SetMarkerColor(1); hien[1]->SetMarkerColor(2); hien[2]->SetMarkerColor(3); hien[3]->SetMarkerColor(6); gStyle->SetPaperSize(16, 16); TCanvas *c1 = new TCanvas("c1", "", 10, 10, 450, 450); TPostScript *ps1 = new TPostScript("plots/all_paddle.eps", -113); ps1->Range(16, 16); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.05); gPad->SetTickx(); gPad->SetTicky(); h1[4]->GetXaxis()->SetRangeUser(0., 60.); h1[4]->DrawClone(); TLegend *leg1 = new TLegend(0.486, 0.432, 0.912, 0.872); Style(leg1); leg1->AddEntry(h1[4], en[4], "l"); for(Int_t i = 3; i >= 0; i--) { if(3 != i) { h1[i]->DrawClone("same"); leg1->AddEntry(h1[i], en[i], "l"); } } leg1->Draw(); for(Int_t i = 0; i < 4; i++) { hien[i]->Draw("pe1same"); } ps1->Close(); gStyle->SetPaperSize(16, 16); TCanvas *c2 = new TCanvas("c2", "", 10, 10, 450, 450); TPostScript *ps2 = new TPostScript("plots/all_paddle_log.eps", -113); ps2->Range(16, 16); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.05); gPad->SetTickx(); gPad->SetTicky(); gPad->SetLogy(); h1[4]->GetXaxis()->SetRangeUser(0., 80.); h1[4]->Draw(); for(Int_t i = 3; i >= 0; i--) { if(3 != i) { h1[i]->Draw("same"); } } for(Int_t i = 0; i < 4; i++) { hien[i]->Draw("pe1same"); } ps2->Close(); TFile *ofile = new TFile("s406.sim.all.root", "RECREATE"); for(Int_t i = 0; i < 5; i++) { h1[i]->SetName((TString(h1[i]->GetName())+eno[i]).Data()); h1[i]->Write(); } ofile->Close(); }
void plot_mult() { TPstyle(); TString names[] = {"/Users/kresan/neuland/r3bcalibr.s406.255AMeV.root", "/Users/kresan/neuland/r3bcalibr.s406.498AMeV.root", "/Users/kresan/neuland/r3bcalibr.s406.799AMeV.root", "/Users/kresan/neuland/r3bcalibr.s406.1014AMeV.root", "/Users/kresan/neuland/r3bcalibr.s406.1500AMeV.root" }; TString en[] = {"255 AMeV", "498 AMeV", "799 AMeV", "1014 AMeV", "1500 AMeV"}; TString eno[] = {"_255", "_498", "_799", "_1014", "_1500"}; TFile *file[5]; TH1F *h1[5]; Double_t nev[5]; for(Int_t i = 0; i < 5; i++) { file[i] = new TFile(names[i]); h1[i] = (TH1F*) file[i]->Get("Multiplicity1"); nev[i] = h1[i]->Integral(2, 100); h1[i]->SetLineColor(i+1); h1[i]->SetBinContent(1, 0); h1[i]->Scale(1./nev[i]); } Style(h1[0], "Multiplicity", "probability"); h1[4]->SetLineColor(6); // h1[4]->Scale(2.2); TFile *ifile = new TFile("data/all_histos.root"); TH1F *himult[4]; TH1F *hien[4]; TString ien[] = {"300", "500", "800", "1500"}; Double_t inev[4]; for(Int_t i = 0; i < 4; i++) { himult[i] = (TH1F*) ifile->Get((TString("hMulti")+ien[i]).Data()); hien[i] = (TH1F*) ifile->Get((TString("hMulti")+ien[i]).Data()); inev[i] = himult[i]->GetEntries(); hien[i]->Sumw2(); hien[i]->Scale(1./inev[i]); // hien[i]->SetMarkerSize(1.2); hien[i]->SetMarkerStyle(20); hien[i]->SetStats(kFALSE); hien[i]->SetBinContent(1, 0); cout << inev[i] << endl; } hien[0]->SetLineColor(1); hien[1]->SetLineColor(2); hien[2]->SetLineColor(3); hien[3]->SetLineColor(6); hien[0]->SetMarkerColor(1); hien[1]->SetMarkerColor(2); hien[2]->SetMarkerColor(3); hien[3]->SetMarkerColor(6); gStyle->SetPaperSize(16, 16); TCanvas *c1 = new TCanvas("c1", "", 10, 10, 450, 450); TPostScript *ps1 = new TPostScript("plots/all_mult.eps", -113); ps1->Range(16, 16); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.05); gPad->SetTickx(); gPad->SetTicky(); h1[0]->GetXaxis()->SetRangeUser(0., 40.); h1[0]->DrawClone(); TLegend *leg1 = new TLegend(0.486, 0.432, 0.912, 0.872); Style(leg1); for(Int_t i = 4; i >= 1; i--) { if(3 != i) { h1[i]->DrawClone("same"); leg1->AddEntry(h1[i], en[i], "l"); } } leg1->AddEntry(h1[0], en[0], "l"); leg1->Draw(); for(Int_t i = 0; i < 4; i++) { hien[i]->Draw("pe1same"); } ps1->Close(); gStyle->SetPaperSize(16, 16); TCanvas *c2 = new TCanvas("c2", "", 10, 10, 450, 450); TPostScript *ps2 = new TPostScript("plots/all_mult_log.eps", -113); ps2->Range(16, 16); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.05); gPad->SetTickx(); gPad->SetTicky(); gPad->SetLogy(); h1[0]->GetXaxis()->SetRangeUser(0., 50.); h1[0]->Draw(); for(Int_t i = 4; i >= 1; i--) { if(3 != i) { h1[i]->Draw("same"); } } for(Int_t i = 0; i < 4; i++) { hien[i]->Draw("pe1same"); } ps2->Close(); // TFile *ofile = new TFile("s406.sim.all.root", "RECREATE"); // for(Int_t i = 0; i < 5; i++) { // h1[i]->SetName((TString(h1[i]->GetName())+eno[i]).Data()); // h1[i]->Write(); // } // ofile->Close(); }