Skip to content
Snippets Groups Projects
Commit f70dffa8 authored by Theodore Efremov's avatar Theodore Efremov :hibiscus:
Browse files

[AlPhaPha] Added Calibration

parent b5207933
No related branches found
No related tags found
No related merge requests found
Showing
with 61 additions and 43 deletions
IC_Z_CALIBRATION -32.1669 0.0175119 -2.00422e-06 1.24893e-10 -3.72936e-15 4.29223e-20 IC_Z_CALIBRATION -31.5137 0.0166442 -1.88596e-06 1.17654e-10 -3.47639e-15 3.91394e-20
\ No newline at end of file \ No newline at end of file
File added
File added
File added
No preview for this file type
for run in {245..252}; do
./convert_snakemake_generic.sh "$run"
wait
done
...@@ -20,7 +20,7 @@ snakemake --cores 30 --forceall --keep-incomplete --keep-going --rerun-incomplet ...@@ -20,7 +20,7 @@ snakemake --cores 30 --forceall --keep-incomplete --keep-going --rerun-incomplet
echo "- snakemake executed successfully!" echo "- snakemake executed successfully!"
echo "- Merging file..." echo "- Merging file..."
OName="\"Run${RUN_NUMBER}\"" OName="\"Run${RUN_NUMBER}ZSpline\""
OPATH="\"root/analysis\"" OPATH="\"root/analysis\""
Path="\"../DataMacro/output/analysis/run_${RUN_NUMBER}/run_raw_${RUN_NUMBER}_\"" Path="\"../DataMacro/output/analysis/run_${RUN_NUMBER}/run_raw_${RUN_NUMBER}_\""
......
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
TChain* chain; TChain* chain;
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
void FillHistoCharge(){ void FillHistoCharge( const char *Path){
const char * Path = "../../../../root/analysis/Run247ZSpline.root";
chain = new TChain("PhysicsTree"); chain = new TChain("PhysicsTree");
chain->Add(Path); chain->Add(Path);
......
...@@ -14,7 +14,8 @@ int RunNumber = 247 ; ...@@ -14,7 +14,8 @@ int RunNumber = 247 ;
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
void FitCharge(){ void FitCharge(){
TFile* ifile = new TFile(Form("Output/histo_charge_%d.root",RunNumber),"read"); //TFile* ifile = new TFile(Form("Output/histo_charge_%d.root",RunNumber),"read");
TFile* ifile = new TFile(Form("Output/histo_charge_merged.root"),"read");
ofile = new TFile("Output/histo_charge_fitted.root","recreate"); ofile = new TFile("Output/histo_charge_fitted.root","recreate");
...@@ -30,8 +31,8 @@ void Fit(TH1F* hcharge,string Energy){ ...@@ -30,8 +31,8 @@ void Fit(TH1F* hcharge,string Energy){
hcharge->Rebin(rebin); hcharge->Rebin(rebin);
hcharge->Draw(); hcharge->Draw();
int Zmin = 29; int Zmin = 31;
int Zmax = 65; int Zmax = 66;
int Z = Zmin; int Z = Zmin;
...@@ -46,7 +47,7 @@ void Fit(TH1F* hcharge,string Energy){ ...@@ -46,7 +47,7 @@ void Fit(TH1F* hcharge,string Energy){
vector<double> Yield(NumberOfZ); vector<double> Yield(NumberOfZ);
for(int i=0; i<NumberOfZ; i++){ for(int i=0; i<NumberOfZ; i++){
g[i] = new TF1(Form("g%i",i),"gaus",Z-0.4,Z+0.4); g[i] = new TF1(Form("g%i",i),"gaus",Z-0.3,Z+0.6);
if(i==0){ if(i==0){
g[i]->SetParameter(0,100); g[i]->SetParameter(0,100);
g[i]->SetParameter(1,Zmin); g[i]->SetParameter(1,Zmin);
...@@ -64,7 +65,7 @@ void Fit(TH1F* hcharge,string Energy){ ...@@ -64,7 +65,7 @@ void Fit(TH1F* hcharge,string Energy){
hcharge->Fit(g[i],"qBR"); hcharge->Fit(g[i],"qBR");
g[i]->Draw("lsame"); //g[i]->Draw("lsame");
g[i]->GetParameters(&para[3*i]); g[i]->GetParameters(&para[3*i]);
Z++; Z++;
...@@ -77,7 +78,7 @@ void Fit(TH1F* hcharge,string Energy){ ...@@ -77,7 +78,7 @@ void Fit(TH1F* hcharge,string Energy){
total_func += "+" + gaus_func; total_func += "+" + gaus_func;
} }
TF1* total = new TF1("total",total_func,Zmin-0.5, Zmin+NumberOfZ-0.5); TF1* total = new TF1("total",total_func,Zmin-0.3, Zmin+NumberOfZ -0.7);
total->SetParameters(para); total->SetParameters(para);
Z = Zmin; Z = Zmin;
for(int i=0; i<NumberOfZ; i++){ for(int i=0; i<NumberOfZ; i++){
...@@ -126,12 +127,15 @@ void Fit(TH1F* hcharge,string Energy){ ...@@ -126,12 +127,15 @@ void Fit(TH1F* hcharge,string Energy){
cout << "Sigma= " << sigma << "+/-" << sigma_err << endl; cout << "Sigma= " << sigma << "+/-" << sigma_err << endl;
cout << "Sigma/Z = " << 2.35*sigma /Z*100. << endl; cout << "Sigma/Z = " << 2.35*sigma /Z*100. << endl;
if (2.35*sigma/Z*100 > 1 && 2.35*sigma/Z*100 < 3){MeanSigmaZ += 2.35*sigma/Z*100;} //if (2.35*sigma/Z*100 > 1 && 2.35*sigma/Z*100 < 3){MeanSigmaZ += 2.35*sigma/Z*100;}
if (i==0 || i==NumberOfZ){continue;}
MeanSigmaZ += 2.35*sigma/Z*100;
gsigma->SetPoint(i,Z,sigma); gsigma->SetPoint(i-1,Z,sigma);
gsigma->SetPointError(i,0,sigma_err); gsigma->SetPointError(i-1,0,sigma_err);
gsigmaZ->SetPoint(i,Z,2.35*sigma/Z*100); gsigmaZ->SetPoint(i-1,Z,2.35*sigma/Z*100);
Integral[i] = (12.5/rebin)*Amplitude*sigma*sqrt(2*TMath::Pi()); Integral[i] = (12.5/rebin)*Amplitude*sigma*sqrt(2*TMath::Pi());
Integral_err[i] = (12.5/rebin)*sqrt(2*TMath::Pi()*(pow(sigma*Amplitude_err,2) + pow(Amplitude*sigma_err,2))); Integral_err[i] = (12.5/rebin)*sqrt(2*TMath::Pi()*(pow(sigma*Amplitude_err,2) + pow(Amplitude*sigma_err,2)));
......
...@@ -52,7 +52,12 @@ void SplineChio() ...@@ -52,7 +52,12 @@ void SplineChio()
chain->SetBranchStatus("IC", true); chain->SetBranchStatus("IC", true);
chain->SetBranchAddress("IC", &IC); chain->SetBranchAddress("IC", &IC);
double FF_IC_X;
chain->SetBranchStatus("FF_IC_X", true);
chain->SetBranchAddress("FF_IC_X", &FF_IC_X);
// ****************** Load Time ********************************** // ****************** Load Time **********************************
...@@ -83,8 +88,9 @@ void SplineChio() ...@@ -83,8 +88,9 @@ void SplineChio()
chain->GetEntry(e); chain->GetEntry(e);
if(FF_IC_X>-530 ){
hChioDE_E_all->Fill(IC->Eres,IC->DE); hChioDE_E_all->Fill(IC->Eres,IC->DE);
}
//for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(Chio_E,FF_DE)) {hChioDE_E[i]->Fill(Chio_E,FF_DE); break;} //for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(Chio_E,FF_DE)) {hChioDE_E[i]->Fill(Chio_E,FF_DE); break;}
for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(IC->Eres,IC->DE)) {hChioDE_E[i]->Fill(IC->Eres,IC->DE); break;} for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(IC->Eres,IC->DE)) {hChioDE_E[i]->Fill(IC->Eres,IC->DE); break;}
...@@ -113,12 +119,12 @@ void MakeSpline(){ ...@@ -113,12 +119,12 @@ void MakeSpline(){
// ********************** Load prev histo**************************** // ********************** Load prev histo****************************
TFile *inFile=new TFile("histo/SingleZ_ChioDE_E.root"); TFile *inFile=new TFile("histo/SingleZ_ChioDE_E.root");
int Z59POS = 28; int Z59POS = 28;
vector<TSpline3*> gspline(Ncuts); vector<TSpline3*> gspline(Ncuts);
vector<TH2F*> h2 (Ncuts); vector<TH2F*> h2 (Ncuts);
vector<TH1F*> hProfile(Ncuts); vector<TH1F*> hProfile(Ncuts);
vector<TH1F*> pfx(Ncuts); // extended hProfile vector<TH1F*> pfx(Ncuts); // extended hProfile
TFile* fspline=new TFile("Output/spline_Chio_2024.root","recreate"); TFile* fspline=new TFile("Output/spline_Chio_2024.root","recreate");
TCanvas * canfit = new TCanvas("canfit","canfit",0,0,2000,1500); TCanvas * canfit = new TCanvas("canfit","canfit",0,0,2000,1500);
...@@ -212,13 +218,13 @@ void MakeSpline(){ ...@@ -212,13 +218,13 @@ void MakeSpline(){
fspline->Close(); fspline->Close();
TFile* CalOut=new TFile("../../../../Calibration/VAMOS/CHIO/Z_spline.root","recreate"); TFile* CalOut=new TFile("../../../../Calibration/VAMOS/CHIO/Z_spline.root","recreate");
for (TSpline3 * i : gspline){ for (TSpline3 * i : gspline){
i->Write(); i->Write();
} }
CalOut->Close(); CalOut->Close();
TGraph * gr = new TGraph(); TGraph * gr = new TGraph();
gr->SetName("DEvsZ"); gr->SetName("DEvsZ");
TCanvas * can = new TCanvas("ChioEcorr_vs_Ebis_for_TSplines","ChioEcorr_vs_Ebis_for_TSplines",0,0,2500,2000); TCanvas * can = new TCanvas("ChioEcorr_vs_Ebis_for_TSplines","ChioEcorr_vs_Ebis_for_TSplines",0,0,2500,2000);
...@@ -236,11 +242,11 @@ void MakeSpline(){ ...@@ -236,11 +242,11 @@ void MakeSpline(){
vector<double> YEdgesMin = GetMinMaxY(cutZ.at(0)); vector<double> YEdgesMin = GetMinMaxY(cutZ.at(0));
vector<double> YEdgesMax = GetMinMaxY(cutZ.at(Ncuts-1)); vector<double> YEdgesMax = GetMinMaxY(cutZ.at(Ncuts-1));
double x1 = (XEdgesMin.at(0) + XEdgesMin.at(1)) /2; double x1 = (XEdgesMin.at(0) + XEdgesMin.at(1)) /2;
double x2 = (XEdgesMax.at(0) + XEdgesMax.at(1)) /2; double x2 = (XEdgesMax.at(0) + XEdgesMax.at(1)) /2;
double y1 = (YEdgesMin.at(0) + YEdgesMin.at(1)) /2; double y1 = (YEdgesMin.at(0) + YEdgesMin.at(1)) /2;
double y2 = (YEdgesMax.at(0) + YEdgesMax.at(1)) /2; double y2 = (YEdgesMax.at(0) + YEdgesMax.at(1)) /2;
TF1 *MeanPos = Linear(y1,x1,y2,x2,"MeanPos"); TF1 *MeanPos = Linear(y1,x1,y2,x2,"MeanPos");
for(int i=0;i<Ncuts;i++){ for(int i=0;i<Ncuts;i++){
...@@ -448,7 +454,7 @@ void ApplySplineUnique() ...@@ -448,7 +454,7 @@ void ApplySplineUnique()
Eval_DEspline = gspline[24]->Eval(IC->Eres); Eval_DEspline = gspline[24]->Eval(IC->Eres);
DEspline0 = FF_DEcorr0[24]; DEspline0 = FF_DEcorr0[24];
FF_DEcorr = DEspline0 * IC->DE / Eval_DEspline ; FF_DEcorr = DEspline0 * IC->DE / Eval_DEspline ;
hChioDE_E_corr->Fill(IC->Eres,FF_DEcorr); hChioDE_E_corr->Fill(IC->Eres,FF_DEcorr);
//if(FF_DEcorr>15120 && FF_DEcorr<15130) { //if(FF_DEcorr>15120 && FF_DEcorr<15130) {
...@@ -526,6 +532,10 @@ void ApplySpline() ...@@ -526,6 +532,10 @@ void ApplySpline()
chain->SetBranchStatus("IC", true); chain->SetBranchStatus("IC", true);
chain->SetBranchAddress("IC", &IC); chain->SetBranchAddress("IC", &IC);
double FF_IC_X;
chain->SetBranchStatus("FF_IC_X", true);
chain->SetBranchAddress("FF_IC_X", &FF_IC_X);
// variable after applying TSpline // variable after applying TSpline
double FF_DEcorr=0; double FF_DEcorr=0;
...@@ -538,11 +548,11 @@ void ApplySpline() ...@@ -538,11 +548,11 @@ void ApplySpline()
vector<double> YEdgesMin = GetMinMaxY(cutZ.at(0)); vector<double> YEdgesMin = GetMinMaxY(cutZ.at(0));
vector<double> YEdgesMax = GetMinMaxY(cutZ.at(Ncuts-1)); vector<double> YEdgesMax = GetMinMaxY(cutZ.at(Ncuts-1));
double x1 = (XEdgesMin.at(0) + XEdgesMin.at(1)) /2; double x1 = (XEdgesMin.at(0) + XEdgesMin.at(1)) /2;
double x2 = (XEdgesMax.at(0) + XEdgesMax.at(1)) /2; double x2 = (XEdgesMax.at(0) + XEdgesMax.at(1)) /2;
double y1 = (YEdgesMin.at(0) + YEdgesMin.at(1)) /2; double y1 = (YEdgesMin.at(0) + YEdgesMin.at(1)) /2;
double y2 = (YEdgesMax.at(0) + YEdgesMax.at(1)) /2; double y2 = (YEdgesMax.at(0) + YEdgesMax.at(1)) /2;
TF1 *MeanPos = Linear(y1,x1,y2,x2,"MeanPos"); TF1 *MeanPos = Linear(y1,x1,y2,x2,"MeanPos");
for(int index=0; index<Ncuts; index++){ for(int index=0; index<Ncuts; index++){
...@@ -568,9 +578,9 @@ void ApplySpline() ...@@ -568,9 +578,9 @@ void ApplySpline()
} }
Double_t p[6]; // Assuming 5 values Double_t p[6]; // Assuming 5 values
if (Loaded == true){ if (Loaded == true){
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
file >> p[i]; file >> p[i];
} }
} }
int Nentries=2e6; int Nentries=2e6;
//int Nentries = chain->GetEntries(); //int Nentries = chain->GetEntries();
...@@ -593,6 +603,7 @@ void ApplySpline() ...@@ -593,6 +603,7 @@ void ApplySpline()
if (IC->DE<3000) continue; if (IC->DE<3000) continue;
if(IC->Eres==FF_Eres_prev) continue; if(IC->Eres==FF_Eres_prev) continue;
if (FF_IC_X<-530) continue;
FF_Eres_prev = IC->Eres; FF_Eres_prev = IC->Eres;
hChioDE_E_all->Fill(IC->Eres,IC->DE); hChioDE_E_all->Fill(IC->Eres,IC->DE);
......
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