Skip to content
Snippets Groups Projects
Commit ddc262ae authored by Pierre Morfouace's avatar Pierre Morfouace
Browse files

updating macro for e850

parent cdaec50b
No related branches found
No related tags found
1 merge request!27Draft: [Epic] Preparation of the environement for the new GaseousDetectorScorers...
...@@ -20,7 +20,7 @@ void FillHistoMass(string part="part1"){ ...@@ -20,7 +20,7 @@ void FillHistoMass(string part="part1"){
chain->Add("../../root/analysis/run_28.root"); chain->Add("../../root/analysis/run_28.root");
chain->Add("../../root/analysis/run_29.root"); chain->Add("../../root/analysis/run_29.root");
chain->Add("../../root/analysis/run_30.root"); chain->Add("../../root/analysis/run_30.root");
chain->Add("../../root/analysis/run_31.root"); //chain->Add("../../root/analysis/run_31.root");
chain->Add("../../root/analysis/run_32.root"); chain->Add("../../root/analysis/run_32.root");
chain->Add("../../root/analysis/run_36.root"); chain->Add("../../root/analysis/run_36.root");
chain->Add("../../root/analysis/run_37.root"); chain->Add("../../root/analysis/run_37.root");
......
...@@ -61,7 +61,7 @@ void Fit(TH1F* hmass,string Energy){ ...@@ -61,7 +61,7 @@ void Fit(TH1F* hmass,string Energy){
} }
g[i]->SetParLimits(1,A-0.1,A+0.1); g[i]->SetParLimits(1,A-0.1,A+0.1);
g[i]->SetParLimits(2,0.25,0.4); g[i]->SetParLimits(2,0.25,0.37);
hmass->Fit(g[i],"qBR"); hmass->Fit(g[i],"qBR");
...@@ -88,10 +88,11 @@ void Fit(TH1F* hmass,string Energy){ ...@@ -88,10 +88,11 @@ void Fit(TH1F* hmass,string Energy){
total->SetParameter(3*i+1,g[i]->GetParameter(1)); total->SetParameter(3*i+1,g[i]->GetParameter(1));
total->SetParameter(3*i+2,g[i]->GetParameter(2)); total->SetParameter(3*i+2,g[i]->GetParameter(2));
total->SetParLimits(3*i+1,A-0.2,A+0.2); total->SetParLimits(3*i+1,A-0.2,A+0.2);
total->SetParLimits(3*i+2,g[i]->GetParameter(2)*0.8,g[i]->GetParameter(2)*1.1); total->SetParLimits(3*i+2,g[i]->GetParameter(2)*0.85,g[i]->GetParameter(2)*1.01);
A++; A++;
} }
total->SetLineColor(4); total->SetLineColor(4);
total->SetNpx(1000);
hmass->Fit(total,"RBq"); hmass->Fit(total,"RBq");
...@@ -105,6 +106,13 @@ void Fit(TH1F* hmass,string Energy){ ...@@ -105,6 +106,13 @@ void Fit(TH1F* hmass,string Energy){
double Amplitude_err = total->GetParError(3*i); double Amplitude_err = total->GetParError(3*i);
double mean_err = total->GetParError(3*i+1); double mean_err = total->GetParError(3*i+1);
double sigma_err = total->GetParError(3*i+2); double sigma_err = total->GetParError(3*i+2);
/*double Amplitude = g[i]->GetParameter(0);
double mean = g[i]->GetParameter(1);
double sigma = g[i]->GetParameter(2);
double Amplitude_err = g[i]->GetParError(0);
double mean_err = g[i]->GetParError(1);
double sigma_err = g[i]->GetParError(2);*/
//one_gauss->SetParameter(0,Amplitude); //one_gauss->SetParameter(0,Amplitude);
//one_gauss->SetParameter(1,mean); //one_gauss->SetParameter(1,mean);
......
...@@ -48,7 +48,7 @@ void Fit(TH1F* hmass){ ...@@ -48,7 +48,7 @@ void Fit(TH1F* hmass){
for(int i=0; i<NumberOfA; i++){ for(int i=0; i<NumberOfA; i++){
g[i] = new TF1(Form("g%i",i),"gaus",A-0.4,A+0.4); g[i] = new TF1(Form("g%i",i),"gaus",A-0.4,A+0.4);
if(i==0){ if(i==0){
g[i]->SetParameter(0,100); g[i]->SetParameter(0,200);
g[i]->SetParameter(1,Amin); g[i]->SetParameter(1,Amin);
g[i]->SetParameter(2,0.3); g[i]->SetParameter(2,0.3);
} }
...@@ -62,7 +62,7 @@ void Fit(TH1F* hmass){ ...@@ -62,7 +62,7 @@ void Fit(TH1F* hmass){
} }
hmass->Fit(g[i],"qBR"); hmass->Fit(g[i],"qBR+");
g[i]->Draw("lsame"); g[i]->Draw("lsame");
g[i]->GetParameters(&para[3*i]); g[i]->GetParameters(&para[3*i]);
...@@ -77,7 +77,7 @@ void Fit(TH1F* hmass){ ...@@ -77,7 +77,7 @@ void Fit(TH1F* hmass){
total_func += "+" + gaus_func; total_func += "+" + gaus_func;
} }
TF1* total = new TF1("total",total_func,Amin-0.5, Amin+NumberOfA-0.5); TF1* total = new TF1("total",total_func,Amin-0.5, Amin+NumberOfA);
total->SetParameters(para); total->SetParameters(para);
A = Amin; A = Amin;
for(int i=0; i<NumberOfA; i++){ for(int i=0; i<NumberOfA; i++){
...@@ -85,14 +85,22 @@ void Fit(TH1F* hmass){ ...@@ -85,14 +85,22 @@ void Fit(TH1F* hmass){
total->SetParameter(3*i+1,g[i]->GetParameter(1)); total->SetParameter(3*i+1,g[i]->GetParameter(1));
total->SetParameter(3*i+2,g[i]->GetParameter(2)); total->SetParameter(3*i+2,g[i]->GetParameter(2));
//cout << A << " " << g[i]->GetParameter(1) << endl;
total->SetParLimits(3*i+1,A-0.2,A+0.2); total->SetParLimits(3*i+1,A-0.2,A+0.2);
total->SetParLimits(3*i+2,g[i]->GetParameter(2)*0.85,g[i]->GetParameter(2)*1.15); total->SetParLimits(3*i+2,g[i]->GetParameter(2)*0.85,g[i]->GetParameter(2)*1.15);
A++; A++;
} }
total->SetLineColor(4); total->SetLineColor(4);
total->SetNpx(1000);
hmass->Fit(total,"qR"); TFitResultPtr fit_result_total = hmass->Fit(total,"qBRS");
TMatrixD cov = fit_result_total->GetCovarianceMatrix();
cov.Print();
total->Draw("same");
A = Amin; A = Amin;
for(int i=0; i<NumberOfA; i++){ for(int i=0; i<NumberOfA; i++){
...@@ -102,10 +110,10 @@ void Fit(TH1F* hmass){ ...@@ -102,10 +110,10 @@ void Fit(TH1F* hmass){
double Amplitude_err = total->GetParError(3*i); double Amplitude_err = total->GetParError(3*i);
double sigma_err = total->GetParError(3*i+2); double sigma_err = total->GetParError(3*i+2);
cout << "A= " << A << endl; /*cout << "A= " << A << endl;
cout << "Amplitude= " << Amplitude << " / " << g[i]->GetParameter(0) << endl; cout << "Amplitude= " << Amplitude << " / " << g[i]->GetParameter(0) << endl;
cout << "Mean= " << mean << " / " << g[i]->GetParameter(1) << endl; cout << "Mean= " << mean << " / " << g[i]->GetParameter(1) << endl;
cout << "Sigma= " << sigma << " / " << g[i]->GetParameter(2) << endl; cout << "Sigma= " << sigma << " / " << g[i]->GetParameter(2) << endl;*/
Integral[i] = (12.5/rebin)*Amplitude*sigma*sqrt(2*TMath::Pi()); Integral[i] = (12.5/rebin)*Amplitude*sigma*sqrt(2*TMath::Pi());
......
void PlotYieldEvolution(int A_asked=99){ TGraphErrors* GetGoodenYield(int A);
//////////////////////////////////////////////////
void PlotYieldEvolution(int A_asked=132){
int Energy[11] = {6,7,8,9,10,11,12,13,14,15,16}; int Energy[11] = {6,7,8,9,10,11,12,13,14,15,16};
TGraphErrors* gevol = new TGraphErrors(); TGraphErrors* gevol = new TGraphErrors();
TGraphErrors* g_relative = new TGraphErrors(); TGraphErrors* g_relative = new TGraphErrors();
...@@ -14,7 +17,7 @@ void PlotYieldEvolution(int A_asked=99){ ...@@ -14,7 +17,7 @@ void PlotYieldEvolution(int A_asked=99){
double Sn = 6.534; double Sn = 6.534;
while(ifile>>A>>yield>>yield_err){ while(ifile>>A>>yield>>yield_err){
if(A==A_asked){ if(A==A_asked){
gevol->SetPoint(i,Energy[i]-Sn,yield); gevol->SetPoint(i,Energy[i]-Sn,1.*yield);
gevol->SetPointError(i,0,yield_err); gevol->SetPointError(i,0,yield_err);
g_relative->SetPoint(i,Energy[i]-5.5,yield_err/yield); g_relative->SetPoint(i,Energy[i]-5.5,yield_err/yield);
...@@ -22,7 +25,7 @@ void PlotYieldEvolution(int A_asked=99){ ...@@ -22,7 +25,7 @@ void PlotYieldEvolution(int A_asked=99){
} }
} }
TH2F* h2 = new TH2F("h2","h2",100,-1,10,100,1,8); TH2F* h2 = new TH2F("h2","h2",100,-1,10,100,1,10);
TCanvas* c1 = new TCanvas("c1","c1",800,1600); TCanvas* c1 = new TCanvas("c1","c1",800,1600);
c1->Divide(1,2); c1->Divide(1,2);
c1->cd(1); c1->cd(1);
...@@ -30,7 +33,36 @@ void PlotYieldEvolution(int A_asked=99){ ...@@ -30,7 +33,36 @@ void PlotYieldEvolution(int A_asked=99){
gevol->SetMarkerSize(1); gevol->SetMarkerSize(1);
h2->Draw(); h2->Draw();
gevol->Draw("psame"); gevol->Draw("psame");
if(A_asked==140 || A_asked==97 || A_asked==99 || A_asked==147 || A_asked==132 || A_asked==143){
TGraphErrors* ggooden = GetGoodenYield(A_asked);
ggooden->Draw("psame");
}
c1->cd(2); c1->cd(2);
g_relative->SetMarkerStyle(8); g_relative->SetMarkerStyle(8);
g_relative->Draw("ap"); g_relative->Draw("ap");
}
//////////////////////////////////////////////////
TGraphErrors* GetGoodenYield(int A){
string filename = "gooden/mass_" + to_string(A) + ".dat";
ifstream ifile;
ifile.open(filename.c_str());
double En;
double Y;
double Yerr;
TGraphErrors* gerr = new TGraphErrors();
for(int i=0; i<8; i++){
ifile>>En>>Y>>Yerr;
gerr->SetPoint(i,En,Y);
gerr->SetPointError(i,0,Yerr);
}
gerr->SetMarkerStyle(22);
gerr->SetMarkerColor(2);
return gerr;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment