diff --git a/macro/plot_resol.C b/macro/plot_resol.C deleted file mode 100644 index 202acd549cedea52a4141b740ea454c6310c5e79..0000000000000000000000000000000000000000 --- a/macro/plot_resol.C +++ /dev/null @@ -1,333 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -using namespace std; - -//TFile *f = new TFile("si26ap0-0_250torr-480mm_49.4+-0.00MeV" -/* TFile *f = new TFile("si26ap0-0_250torr-480mm_49.4+-0.50MeV" */ -/* "_1.0ns_de520um_1e+06_ppacs300-680mm" */ -/* //"_1.0ns_de520um_1e+06_ppacs350-630mm" */ -/* "_tel-conf-01.root"); */ -/* TFile *f = new TFile("si26ap0-3_250torr-480mm_49.4+-0.50MeV" */ -/* "_1.0ns_de520um_2e+06_ppacs300-680mm" */ -/* //"_1.0ns_de520um_1e+06_ppacs350-630mm" */ -/* "_tel-conf-01.root"); */ -//TFile *f = new TFile("tmp.root"); -//TFile *f = new TFile("tmp_t1_p1.root"); -Char_t label[50] = "si26ap"; -Char_t simnum[10] = "sim000"; -TFile *f = new TFile(Form("../root/%s_%s.root",label,simnum)); -TTree *tr = (TTree*)f->Get("sim"); - -TF1 *fn1 = new TF1("fn1","gaus",-100,100); - -// void plot_2dhist(const char* var, const char* cut, -// const char* hname, const char* htitle, -// Int_t nx, Double_t xmin, Double_t xmax, -// Int_t ny, Double_t ymin, Double_t ymax){ - -// TH2D *h=new TH2D(hname, htitle, nx,xmin,xmax, ny,ymin,ymax); -// tr->Draw(Form("%s>>%s",var,hname),cut); -// h->Draw(); -// return; -// } - -// void plot_1dhist(const char* var, const char* cut, -// const char* hname, const char* htitle, -// Int_t nx, Double_t xmin, Double_t xmax){ - -// TH1D *h=new TH1D(hname, htitle, nx,xmin,xmax); -// tr->Draw(Form("%s>>%s",var,hname),cut); -// h->Draw(); -// return; -// } - -void plot_fit_hist(Bool_t wid_or_peak, // 0: width, 1: peak - const char* head, //const *char cut0, - const char* hlabelx, - const char* hlabely, - const char* hlabelyres, - const char* varx, - const char* vary, - const char* varyres, - Int_t nx, Double_t xmin, Double_t xmax, - Int_t ny, Double_t ymin, Double_t ymax, - Int_t nyres, Double_t yminres, Double_t ymaxres){ - - // const Double_t tm = 0.002; - // const Double_t lm = 1.; - // const Double_t rm = 0.002; - // const Double_t bm = ; - // const Double_t toff = 1.; - - TCanvas *c1=new TCanvas(head,head,0,0,1500,900); - c1->Divide(5,3); - // gPad->SetTopMargin(tm); - // gPad->SetLeftMargin(lm); - // gPad->SetRightMargin(rm); - // gPad->SetBottomMargin(bm); - // TCanvas *c2=new TCanvas(Form("%s_res",head),Form("%s_res",head), - // 1500,0,800,600); - - char cut[100], hname[100], hnameres[100]; - - TH1D *h1d=new TH1D("h1d","",ny,ymin,ymax); - vector vpar[5], evpar[5], vx[5]; - TGraphErrors *gr[5]; - - TH2D *h[5], *hres[5]; - TH1F *fr[5]; - - Double_t par; - - //c1->Divide(5,3); - for(Int_t i=0; i<5; i++){ - sprintf(cut,"idet==%d&&iex==0",i); - - c1->cd(i+1); - sprintf(hname,"%s_tel%d",head,i+1); - h[i]=new TH2D(hname, Form("%s;%s;%s",hname,hlabelx,hlabely), - nx,xmin,xmax, ny,ymin,ymax); - tr->Draw(Form("%s:%s>>%s",vary,varx,hname),cut); - h[i]->Draw(); - ///// - c1->cd(i+6); - // sprintf(varres,"Ecm-Ecm_MC:Elab2_det"); - sprintf(hnameres,"res_%s_tel%d",head,i+1); - hres[i]=new TH2D(hnameres, - Form("%s;%s;%s",hnameres,hlabelx,hlabelyres), - nx,xmin,xmax, nyres,yminres,ymaxres); - tr->Draw(Form("%s:%s>>%s",varyres,varx,hnameres),cut); - hres[i]->GetYaxis()->SetTitleOffset(1.2); - hres[i]->Draw(); - ///// - //c2->cd(); - Double_t x0 = xmin; - Double_t dx = (xmax - xmin)/double(nx); - Double_t x1 = x0 + dx; - for(Int_t j=0; jProjectionY(Form("%s_py",hname),j,j+1); - if(h1d->GetEntries() > 10){ - vx[i].push_back((x0+x1)/2.); - //fn1->SetParameter(2,ymaxres*0.1); - h1d->Fit(fn1,"nq"); - if(wid_or_peak){ - par = fn1->GetParameter(1); // peak - vpar[i].push_back(par); - par = fn1->GetParameter(2); // width - evpar[i].push_back(par); - }else{ - par = fn1->GetParameter(2); // width - vpar[i].push_back(par); - evpar[i].push_back(0.); - } - //cout << par << endl; - //c2->Update(); gSystem->ProcessEvents(); //getchar(); - } - x0 = x1; - x1 += dx; - } - ///// - c1->cd(i+11); - if(wid_or_peak){ - fr[i] = gPad->DrawFrame(xmin,yminres,xmax,ymaxres); // peak - fr[i]->GetYaxis()->SetTitle(hlabelyres); - }else{ - fr[i] = gPad->DrawFrame(xmin,0.,xmax,ymaxres); // width - fr[i]->GetYaxis()->SetTitle(hlabely); - } - gr[i] = new TGraphErrors(vx[i].size(),&(vx[i].at(0)),&(vpar[i].at(0)), - 0,&(evpar[i].at(0))); - gr[i]->Draw("EL"); - fr[i]->GetXaxis()->SetTitle(hlabelx); - fr[i]->GetYaxis()->SetTitleOffset(1.2); - c1->Update(); gSystem->ProcessEvents(); - } - c1->Print(Form("../figs/%s_%s_%s.png",head,label,simnum)); - return; -} - -int main(){ - const Double_t lbsize = 0.06; - const Double_t txsize = 0.06; - - TApplication theApp("App", NULL, NULL); - gStyle->SetTextFont(62); - gStyle->SetTextSize(lbsize); - - gStyle->SetLabelFont(62,"XYZ"); - gStyle->SetLabelSize(lbsize,"XYZ"); - - //gStyle->SetTitleFont(62); - gStyle->SetTitleFont(62,"XYZ"); - gStyle->SetTitleSize(lbsize,"XYZ"); - gStyle->SetTitleFontSize(lbsize); - - gStyle->SetPadTopMargin(0.02); - gStyle->SetPadRightMargin(0.02); - gStyle->SetPadLeftMargin(0.16); - gStyle->SetPadBottomMargin(0.16); - - // gStyle->SetStatW(0.3); - // gStyle->SetStatH(0.2); - // gStyle->SetStatX(1); - // gStyle->SetStatY(0.4); - gStyle->SetOptStat(0); - - gSystem->Exec("mkdir -vp ../figs");//Creates figs/ directory if there is not - - /* //Ecm vs. Elab2_det */ - /* plot_fit_hist(0, "ecm-elab", // header */ - /* "Proton energy at detector (MeV)", // X label */ - /* "E_{c.m.} (MeV)", // Y label */ - /* "E_{c.m.} deviation (MeV)", // Y deviation label */ - /* "E.lab2_det", "E.cm_MC", "E.cm-E.cm_MC", //X,Y,Y deviation */ - /* 100,0.,22., 100,0.,7., 44,-0.3,0.3 // binning */ - /* ); */ - - /* plot_fit_hist(1, "ecm-elab_MC", // header */ - /* "Proton energy deviation (MeV)", // X label */ - /* "E_{c.m.} (MeV)", // Y label */ - /* "E_{c.m.} deviation (MeV)", // Y deviation label */ - /* "E.lab2_det - E.lab2_det_MC", */ - /* "E.cm_MC", "E.cm-E.cm_MC", //X,Y,Y deviation */ - /* 100,-0.6,0.6, 100,0.,7., 44,-0.3,0.3 // binning */ - /* ); */ - - /* // Ecm vs. thlab[1] */ - /* plot_fit_hist(0, "ecm-thlab", //const *char cut0, */ - /* "#theta_{proton} (deg.)", */ - /* "E_{c.m.} (MeV)", */ - /* "E_{c.m.} deviation (MeV)", */ - /* "th.lab[1]", "E.cm_MC", "E.cm-E.cm_MC", */ - /* 100,0.,180., 100,0.,7., 44,-0.3,0.3 */ - /* ); */ - - /* plot_fit_hist(1, "ecm-thlab_MC", //const *char cut0, */ - /* "#theta_{proton} deviation (deg.)", */ - /* "E_{c.m.} (MeV)", */ - /* "E_{c.m.} deviation (MeV)", */ - /* "th.lab[1]-th.lab2_MC", "E.cm_MC", "E.cm-E.cm_MC", */ - /* 100,-10.,10., 100,0.,7., 44,-0.3,0.3 */ - /* ); */ - - // Ecm vs. ldec_det - plot_fit_hist(0, "ldec_det", // header - "Distance from reaction point to detector (mm)", // X label - "E_{c.m.} (MeV)", // Y label - "E_{c.m.} deviation (MeV)", // Y deviation label - "ldec_det", "E.cm_MC", "E.cm-E.cm_MC", - 100,0.,400., 100,0.,7., 44,-0.3,0.3 // binning - ); - - plot_fit_hist(1, "ldec_det_MC", // header - "Distance from reaction point to detector (mm)", // X label - "E_{c.m.} (MeV)", // Y label - "E_{c.m.} deviation (MeV)", // Y deviation label - "ldec_det - ldec_det_MC", "E.cm_MC", "E.cm-E.cm_MC", - 100,-20.,20., 100,0.,7., 44,-0.3,0.3 // binning - ); - - /* // Ecm vs. ztar */ - /* plot_fit_hist(0, "ecm-ztar", // header */ - /* "Target depth (mm)", // X label */ - /* "E_{c.m.} (MeV)", // Y label */ - /* "E_{c.m.} deviation (MeV)", // Y deviation label */ - /* "pos.ztar", "E.cm_MC", "E.cm-E.cm_MC", */ - /* 100,-250.,250., 100,0.,7., 44,-0.3,0.3 // binning */ - /* ); */ - - /* plot_fit_hist(1, "ecm-ztar_MC", // header */ - /* "Target depth deviation (mm)", // X label */ - /* "E_{c.m.} (MeV)", // Y label */ - /* "E_{c.m.} deviation (MeV)", // Y deviation label */ - /* "pos.ztar-pos.ztar_MC", "E.cm_MC", "E.cm-E.cm_MC", */ - /* 100,-20.,20., 100,0.,7., 44,-0.3,0.3 // binning */ - /* ); */ - - /* // Ecm vs. xtar */ - /* plot_fit_hist(0, "ecm-xtar", // header */ - /* "X at reaction position (mm)", // X label */ - /* "E_{c.m.} (MeV)", // Y label */ - /* "E_{c.m.} deviation (MeV)", // Y deviation label */ - /* "pos.xtar", "E.cm_MC", "E.cm-E.cm_MC", */ - /* 100,-40.,40., 100,0.,7., 44,-0.3,0.3 // binning */ - /* ); */ - - /* plot_fit_hist(1, "ecm-xtar_MC", // header */ - /* "X deviation (mm)", // X label */ - /* "E_{c.m.} (MeV)", // Y label */ - /* "E_{c.m.} deviation (MeV)", // Y deviation label */ - /* "pos.xtar-pos.xtar_MC", "E.cm_MC", "E.cm-E.cm_MC", */ - /* 100,-15.,15., 100,0.,7., 44,-0.3,0.3 // binning */ - /* ); */ - - /* // Ecm vs target thickness */ - /* plot_fit_hist(1, "ecm-pressure_MC", // header */ - /* "Pressure deviation (Torr)", // X label */ - /* "E_{c.m.} (MeV)", // Y label */ - /* "E_{c.m.} deviation (MeV)", // Y deviation label */ - /* "gas.prs - gas.prs0", "E.cm_MC", "E.cm-E.cm_MC", //X,Y,Y deviation */ - /* 100,-10.,10., 100,0.,7., 44,-0.3,0.3 // binning */ - /* ); */ - - /* plot_fit_hist(1, "ecm-temperature_MC", // header */ - /* "Temperature deviation (K)", // X label */ - /* "E_{c.m.} (MeV)", // Y label */ - /* "E_{c.m.} deviation (MeV)", // Y deviation label */ - /* "gas.tmp - gas.tmp0", */ - /* "E.cm_MC", "E.cm-E.cm_MC", //X,Y,Y deviation */ - /* 100,-10.,10., 100,0.,7., 44,-0.3,0.3 // binning */ - /* ); */ - - /* /\* //SA vs. pressure *\/ */ - /* /\* plot_fit_hist(1, "sa-pressure_MC", // header *\/ */ - /* /\* "Pressure deviation (Torr)", // X label *\/ */ - /* /\* "Distance reac - det (mm)", // Y label *\/ */ - /* /\* "Solidangle deviation (%)", // Y deviation label *\/ */ - /* /\* "gas.prs - gas.prs0", "pos.ldec_det", *\/ */ - /* /\* "2.*(pos.ldec_det - pos.ldec_det_MC)/pos.ldec_det*100.", *\/ */ - /* /\* 100,-10.,10., 100,0.,250., 50,-25.,25. // binning *\/ */ - /* /\* ); *\/ */ - - /* /\* plot_fit_hist(1, "sa-temperature_MC", // header *\/ */ - /* /\* "Temperature deviation (K)", // X label *\/ */ - /* /\* "Distance reE_{c.m.} (MeV)", // Y label *\/ */ - /* /\* "Solidangle deviation (%)", // Y deviation label *\/ */ - /* /\* "gas.tmp - gas.tmp0", "pos.ldec_det", *\/ */ - /* /\* "2.*(pos.ldec_det - pos.ldec_det_MC)/pos.ldec_det*100.", *\/ */ - /* /\* 100,-10.,10., 100,0.,250., 50,-25.,25. // binning *\/ */ - /* /\* ); *\/ */ - - /* //Ecm vs. ztar */ - /* plot_fit_hist(0, "thcm-ztar", // header */ - /* - "Target depth (mm)", // X label */ - /* "#theta_{c.m.} (deg.)", // Y label */ - /* "#theta_{c.m.} deviation (deg.)", // Y deviation label */ -.hv b /* "pos.ztar", "th.cm_MC", "th.cm-th.cm_MC", */ - /* 100,-250.,250., 180,0.,180., 80,-20.,20. // binning */ - /* ); */ - - /* plot_fit_hist(1, "thcm-ztar_MC", // header */ - /* "Target depth deviation (mm)", // X label */ - /* "#theta_{c.m.} (deg.)", // Y label */ - /* "#theta_{c.m.} deviation (deg.)", // Y deviation label */ - /* "pos.ztar-pos.ztar_MC", "th.cm_MC", "th.cm-th.cm_MC", */ - /* 100,-20.,20., 180,0.,180., 80,-20.,20. // binning */ - /* ); */ - - - - theApp.Run(); -}