/
ddushpanov
/
bmn_macro
Обзор
Документация
Войти
/
ddushpanov
/
bmn_macro
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
nir_macro.cpp
63 строки
3 KB
Dmitriy Dushpanov
added hists comparsions for student research work
12 дек 2025, 03:17
12 дек 2025, 03:17
b938ca2
Код
Авторство
О чём код?
#include <root/TFile.h> #include <root/TH1F.h> #include <root/TH2F.h> #include <root/TF1.h> #include <root/TCanvas.h> #include <root/TLegend.h> int main(){ TFile *file_8322 = new TFile("/home/ddushpanov/Documents/science/bmn_macro/results/new_pl_bc1_pics_CCT2_bmn_run_8322_merged_ndet_calibr_1_6.root_dst_ndet_reco.root", "read"); TFile *file_8300 = new TFile("/home/ddushpanov/Documents/science/bmn_macro/results/new_pl_bc1_pics_CCT2_bmn_run_8300_new_ndet_reco.root", "read"); TH1F* nSpectr_n_8322 = (TH1F*)file_8322->Get("nSpectr_n"); TH1F* nSpectr_n_8300 = (TH1F*)file_8300->Get("nSpectr_n"); TCanvas* canv_spectr_comparison = new TCanvas("canvas_spectr_comparison", "nSpectr_n Comparison", 1600, 900); nSpectr_n_8322->SetLineColor(kBlue); nSpectr_n_8322->SetTitle(Form("nSpectr_n Comparison; T_{n}, MeV;Counts/ions")); nSpectr_n_8322->Draw("hist"); nSpectr_n_8322->GetXaxis()->SetRangeUser(0,10000); nSpectr_n_8300->SetLineColor(kRed); nSpectr_n_8300->Draw("hist same"); auto legend = new TLegend(0.7,0.5,0.9,0.7); legend->AddEntry(nSpectr_n_8322,"3 A GeV", "l"); legend->AddEntry(nSpectr_n_8300,"3.8 A GeV","l"); legend->Draw(); canv_spectr_comparison->Print("nir_pictures/nSpectr_n_comparison.png"); TCanvas *time_comparison = new TCanvas("time_comparison", "pNdetTime1F Comparison", 1600, 900); TH1F* pNdetTime1F_8322 = (TH1F*)file_8322->Get("pNdetTime1F"); TH1F* pNdetTime1F_8300 = (TH1F*)file_8300->Get("pNdetTime1F"); pNdetTime1F_8300->SetLineColor(kRed); pNdetTime1F_8300->SetTitle(Form ("pNdetTime1F Comparison; ns; ")); pNdetTime1F_8300->GetXaxis()->SetRangeUser(20,60); pNdetTime1F_8300->DrawNormalized("hist"); pNdetTime1F_8300->GetYaxis()->SetMaxDigits(3); pNdetTime1F_8322->SetLineColor(kBlue); pNdetTime1F_8322->DrawNormalized("hist same"); legend = new TLegend(0.7,0.5,0.9,0.7); legend->AddEntry(pNdetTime1F_8322,"3 A GeV", "l"); legend->AddEntry(pNdetTime1F_8300,"3.8 A GeV","l"); legend->Draw(); canv_spectr_comparison->Print("nir_pictures/nSpectr_n_comparison.png"); TCanvas Edep_comparison("Edep_comparison", "hNdetEdep Comparison", 1600, 900); TH1F* hNdetEdep_8322 = (TH1F*)file_8322->Get("hNdetEdep"); TH1F* hNdetEdep_8300 = (TH1F*)file_8300->Get("hNdetEdep"); hNdetEdep_8300->SetLineColor(kRed); hNdetEdep_8300->SetTitle(Form ("hNdetEdep Comparison; E_{dep}, MIP; ")); hNdetEdep_8322->DrawNormalized("hist"); hNdetEdep_8322->GetYaxis()->SetMaxDigits(3); hNdetEdep_8300->DrawNormalized("hist same"); hNdetEdep_8322->SetLineColor(kBlue); legend = new TLegend(0.7,0.5,0.9,0.7); legend->AddEntry(hNdetEdep_8322,"3 A GeV", "l"); legend->AddEntry(hNdetEdep_8300,"3.8 A GeV","l"); legend->Draw(); Edep_comparison.Print("nir_pictures/hNdetEdep_comparison.png"); file_8300->Close(); file_8322->Close(); return 0; }