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

Correction on IC 0 fail to give better resolution on Z in DE_E Plot so...

Correction on IC 0 fail to give better resolution on Z in DE_E Plot so switching to IC1 correction while dumping IC0 for this plot. We see promising result doing correction with IC1 on Y But X is weird with bump along the natural linear dependency.
parent 06d54dbb
No related branches found
No related tags found
1 merge request!27Draft: [Epic] Preparation of the environement for the new GaseousDetectorScorers...
Pipeline #361019 passed
...@@ -10,9 +10,8 @@ ...@@ -10,9 +10,8 @@
using namespace std; using namespace std;
TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee); TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee, double XMin , double
void ApplySplinePerCut(); XMax, double YMin, double YMax);
void ApplySpline();
void HistoFiller(); void HistoFiller();
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
...@@ -39,13 +38,25 @@ void SplineChioXY( bool Create = false) { ...@@ -39,13 +38,25 @@ void SplineChioXY( bool Create = false) {
vector<TH2F*> hIC; vector<TH2F*> hIC;
hIC.push_back((TH2F*)inFile->Get("hChio_IC0_IC1_X_all")); hIC.push_back((TH2F*)inFile->Get("hChio_IC0_IC1_X_all"));
hIC.push_back((TH2F*)inFile->Get("hChio_IC0_IC1_Y_all")); hIC.push_back((TH2F*)inFile->Get("hChio_IC0_IC1_Y_all"));
hIC.push_back((TH2F*)inFile->Get("hChio_IC1_X"));
hIC.push_back((TH2F*)inFile->Get("hChio_IC1_Y"));
TFile* fspline = new TFile("Output/spline_Chio_2024.root", "recreate"); TFile* fspline = new TFile("Output/spline_Chio_2024.root", "recreate");
int NHist = static_cast<int>(hIC.size());
double XMin[NHist] , XMax[NHist], YMin[NHist] , YMax[NHist];
XMin[0] = -520 ; XMax[0] = 380 ; YMin[0] = 0 ; YMax[0] = 2 ;
XMin[1] = -70 ; XMax[1] = 79 ; YMin[1] = 0 ; YMax[1] = 2 ;
XMin[2] = -520 ; XMax[2] = 380 ; YMin[2] = 2000 ; YMax[2] = 9500 ;
XMin[3] = -70 ; XMax[3] = 79 ; YMin[3] = 2000 ; YMax[3] = 9500 ;
for (int i = 0; i < hIC.size(); i++) { for (int i = 0; i < hIC.size(); i++) {
TSpline3* spline = MakeSpline(hIC[i] , i); TSpline3* spline = MakeSpline(hIC[i] , i, XMin[i] , XMax[i], YMin[i], YMax[i]);
spline->SetName(Form("fspline_%d", i )); if (i < 2) spline->SetName(Form("fsplineIC0_%d", i ));
else if (i>=2) spline->SetName(Form("fsplineIC1_%d",i));
spline->Write(); spline->Write();
} //End loop on histogram } //End loop on histogram
...@@ -84,6 +95,12 @@ void HistoFiller() { ...@@ -84,6 +95,12 @@ void HistoFiller() {
"hChio_IC0_IC1_X_all", 1000, -800, 800, 500, 1, 1.6); "hChio_IC0_IC1_X_all", 1000, -800, 800, 500, 1, 1.6);
TH2F* hChio_IC0_IC1_Y_all = new TH2F("hChio_IC0_IC1_Y_all", TH2F* hChio_IC0_IC1_Y_all = new TH2F("hChio_IC0_IC1_Y_all",
"hChio_IC0_IC1_Y_all", 1000, -160, 160, 500, 1, 1.6); "hChio_IC0_IC1_Y_all", 1000, -160, 160, 500, 1, 1.6);
TH2F* hChio_IC1_Y = new TH2F("hChio_IC1_Y",
"hChio_IC1_Y", 1000, -160, 160, 500, 2000, 9500);
TH2F* hChio_IC1_X = new TH2F("hChio_IC1_X",
"hChio_IC1_X", 1000, -800, 800, 500, 2000, 9500);
//=========================================================================================================== //===========================================================================================================
// Beginning loop on entries // Beginning loop on entries
...@@ -106,9 +123,13 @@ void HistoFiller() { ...@@ -106,9 +123,13 @@ void HistoFiller() {
fIC_raw[i] = IC->fIC_raw[i]; fIC_raw[i] = IC->fIC_raw[i];
} }
hChio_IC0_IC1_X_all->Fill(FF_IC_X , fIC_raw[1] / fIC_raw[0] ); //if (IC->Eres>11000 && IC->Eres < 12000){
hChio_IC0_IC1_Y_all->Fill(FF_IC_Y , fIC_raw[1] / fIC_raw[0] ); hChio_IC0_IC1_X_all->Fill(FF_IC_X , fIC_raw[1] / fIC_raw[0] );
hChio_IC0_IC1_Y_all->Fill(FF_IC_Y , fIC_raw[1] / fIC_raw[0] );
hChio_IC1_X->Fill(FF_IC_X, fIC_raw[1]);
hChio_IC1_Y->Fill(FF_IC_Y, fIC_raw[1]);
//}
// for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(FF_Eres,FF_DE)) {hChioDE_E[i]->Fill(FF_Eres,FF_DE); break;} // for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(FF_Eres,FF_DE)) {hChioDE_E[i]->Fill(FF_Eres,FF_DE); break;}
} // end loop on entries } // end loop on entries
...@@ -125,9 +146,20 @@ void HistoFiller() { ...@@ -125,9 +146,20 @@ void HistoFiller() {
canY->cd(); canY->cd();
hChio_IC0_IC1_Y_all->Draw("colz"); hChio_IC0_IC1_Y_all->Draw("colz");
TCanvas* canX1 = new TCanvas("X1", "X1", 0, 0, 2000, 1000);
canX1->cd();
hChio_IC1_X->Draw("colz");
TCanvas* canY1 = new TCanvas("Y1", "Y1", 0, 0, 2000, 1000);
canY1->cd();
hChio_IC1_Y->Draw("colz");
TFile* outFile = new TFile("Output/Histo.root", "recreate"); TFile* outFile = new TFile("Output/Histo.root", "recreate");
hChio_IC0_IC1_X_all->Write(); hChio_IC0_IC1_X_all->Write();
hChio_IC0_IC1_Y_all->Write(); hChio_IC0_IC1_Y_all->Write();
hChio_IC1_Y->Write();
hChio_IC1_X->Write();
outFile->Close(); outFile->Close();
} // End HistoFiller } // End HistoFiller
...@@ -145,7 +177,8 @@ void HistoFiller() { ...@@ -145,7 +177,8 @@ void HistoFiller() {
* *
*/ */
TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee) { TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee, double XMin = 0 , double
XMax = 1000 , double YMin=0 , double YMax = 100) {
TSpline3* gspline; TSpline3* gspline;
...@@ -154,7 +187,7 @@ TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee) { ...@@ -154,7 +187,7 @@ TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee) {
TCanvas* canfit = new TCanvas(Form("CanSpline_%02d",NCallee), TCanvas* canfit = new TCanvas(Form("CanSpline_%02d",NCallee),
Form("canfit_%02d",NCallee), 0, 0, 1000, 500); Form("canfit_%02d",NCallee), 0, 0, 1000, 500);
//=========================================================================================================== //===========================================================================================================
// Init profile // Init profile
...@@ -166,7 +199,7 @@ TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee) { ...@@ -166,7 +199,7 @@ TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee) {
hProfile->SetDirectory(0); hProfile->SetDirectory(0);
canfit->cd(); canfit->cd();
hProfile->GetYaxis()->SetRangeUser(0, 2); hProfile->GetYaxis()->SetRangeUser(YMin, YMax);
hProfile->Draw(); hProfile->Draw();
//=========================================================================================================== //===========================================================================================================
// First and last bin to get to 6k // First and last bin to get to 6k
...@@ -176,11 +209,11 @@ TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee) { ...@@ -176,11 +209,11 @@ TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee) {
double Treshold = 1; double Treshold = 1;
for (int bin =1 ; bin<hProfile->GetNbinsX(); bin++) { for (int bin =1 ; bin<hProfile->GetNbinsX(); bin++) {
FirstBin = bin; FirstBin = bin;
if (hProfile->GetBinContent(bin)>Treshold) break; if (hProfile->GetBinLowEdge(bin)> XMin) break;
} }
for (int bin = hProfile->GetNbinsX(); bin>1 ; bin--) { for (int bin = hProfile->GetNbinsX(); bin>1 ; bin--) {
LastBin = bin; LastBin = bin;
if (hProfile->GetBinContent(bin)>Treshold) break; if (hProfile->GetBinLowEdge(bin)< XMax) break;
} }
cout << FirstBin << " " << LastBin << endl; cout << FirstBin << " " << LastBin << endl;
//=========================================================================================================== //===========================================================================================================
......
...@@ -36,7 +36,11 @@ void TestSpline() { ...@@ -36,7 +36,11 @@ void TestSpline() {
TH2F* hICorr_X = new TH2F("hICorr_X","hICorr_X",1000,-600,400,500,1,1.6); TH2F* hICorr_X = new TH2F("hICorr_X","hICorr_X",1000,-600,400,500,1,1.6);
TH2F* hICorr_Y = new TH2F("hICorr_Y","hICorr_Y",1000,-100,100,500,1,1.6); TH2F* hICorr_Y = new TH2F("hICorr_Y","hICorr_Y",1000,-100,100,500,1,1.6);
TH2F* hDE_Ecorr = new TH2F("DE_Ecorr","DE_Ecorr",1000,100,1,1000,100,1); TH2F* hDE_Ecorr = new TH2F("DE_Ecorr","DE_Ecorr",1000,100,1,1000,100,1);
TH2F* hDEBis_Ecorr = new
TH2F("DEBis_Ecorr","DEBis_Ecorr",1000,0,20000,1000,0,25000);
TH2F* hDE_E = new TH2F("DE_E","DE_E",1000,100,1,1000,100,1); TH2F* hDE_E = new TH2F("DE_E","DE_E",1000,100,1,1000,100,1);
TH2F* hDE_E_IC1_Corr = new
TH2F("hDE_E_IC1_Corr","hDE_E_IC1_Corr",1000,0,20000,1000,0,25000);
hICorr.push_back(hICorr_X); hICorr.push_back(hICorr_X);
hICorr.push_back(hICorr_Y); hICorr.push_back(hICorr_Y);
...@@ -44,8 +48,10 @@ void TestSpline() { ...@@ -44,8 +48,10 @@ void TestSpline() {
hIC.push_back((TH2F*)fHisto->Get("hChio_IC0_IC1_Y_all")); hIC.push_back((TH2F*)fHisto->Get("hChio_IC0_IC1_Y_all"));
vector<TSpline3*> spline; vector<TSpline3*> spline;
for (int i = 0; i < hIC.size(); i++) { for (int i = 0; i < 4; i++) {
spline.push_back((TSpline3*)fSpline->Get(Form("fspline_%d",i)));
if (i<2) spline.push_back((TSpline3*)fSpline->Get(Form("fsplineIC0_%d",i)));
else if ( i>=2 && i<4) spline.push_back((TSpline3*)fSpline->Get(Form("fsplineIC1_%d",i)));
} //End loop on histogram } //End loop on histogram
...@@ -76,32 +82,58 @@ void TestSpline() { ...@@ -76,32 +82,58 @@ void TestSpline() {
double IC0_Corr = IC->fIC_raw[1] /IC_CorrY; double IC0_Corr = IC->fIC_raw[1] /IC_CorrY;
if (IC0_Corr != IC0_Corr ) IC0_Corr = 0; if (IC0_Corr != IC0_Corr ) IC0_Corr = 0;
double DE = 0 ,E =0 ,DEcorr=0 ;
double IC1_CorrY = IC->fIC_raw[1] * spline[3]->Eval(0) /
spline[3]->Eval(FF_IC_Y) ;
double IC1_CorrX = IC->fIC_raw[1] * spline[2]->Eval(0) /
spline[2]->Eval(FF_IC_X) ;
double DE = 0 ,E =0 ,DEcorr=0 ,DEIC1corr =0;
//===========================================================================================================
// Fill De from seg 1 to 3
//===========================================================================================================
for (int seg = 0 ; seg < sizeof(IC->fIC_raw)/sizeof(IC->fIC_raw[0]) ; seg++ ){ for (int seg = 0 ; seg < sizeof(IC->fIC_raw)/sizeof(IC->fIC_raw[0]) ; seg++ ){
if(seg > 1 && seg < 4) DE += IC->fIC_raw[seg] ; if(seg > 1 && seg < 4) DE += IC->fIC_raw[seg] ;
else if (seg >4) E+= IC->fIC_raw[seg] ; else if (seg >4) E+= IC->fIC_raw[seg] ;
} }
//===========================================================================================================
// Filling DE with ICO
//===========================================================================================================
DEcorr += DE ; DEcorr += DE ;
if (IC0_Corr < 1e10 && IC0_Corr >0){ if ((IC0_Corr < 1e100 && IC0_Corr >-1000) || true){
DEcorr += IC0_Corr ;} DEcorr += IC0_Corr ;
}
else DEcorr += IC->fIC_raw[0]; else DEcorr += IC->fIC_raw[0];
DE += IC->fIC_raw[0] ; DE += IC->fIC_raw[0] ;
DE = DE *0.5 + IC->fIC_raw[4]; DE = DE *0.5 + IC->fIC_raw[4];
DEcorr = DEcorr *0.5 + IC->fIC_raw[4]; DEcorr = DEcorr *0.5 + IC->fIC_raw[4];
/* /*
cout << IC0_Corr << " " << IC->fIC_raw[0] << endl; cout << IC0_Corr << " " << IC->fIC_raw[0] << endl;
cout << DEcorr << " " << DE << endl; cout << DEcorr << " " << DE << endl;
cout << "*************************" << endl; cout << "*************************" << endl;
*/ */
//===========================================================================================================
// Chio online
//===========================================================================================================
double IC1corr = (IC->fIC_raw[1]*(1-0.000686068*FF_IC_Y))*(1-4.88238e-05*FF_IC_Y+7.40395e-06*FF_IC_Y*FF_IC_Y);
double DE_Bis = 0.5*(IC1corr+IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4];
//double DE_Bis = 0.5*(IC->fIC_raw[1]+IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4];
DEIC1corr = 0.5*(IC1_CorrY +IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4];
hDEBis_Ecorr->Fill(E,DE_Bis);
hDE_E->Fill(E,DE); hDE_E->Fill(E,DE);
hDE_Ecorr->Fill(E,DEcorr); hDE_Ecorr->Fill(E,DEcorr);
hDE_E_IC1_Corr->Fill(E,DEIC1corr);
} //End loop on event } //End loop on event
//=========================================================================================================== //===========================================================================================================
...@@ -119,12 +151,15 @@ void TestSpline() { ...@@ -119,12 +151,15 @@ void TestSpline() {
c1->cd(4); c1->cd(4);
hIC[1]->Draw(); hIC[1]->Draw();
TCanvas* c2 = new TCanvas("c2","c2",1000,1000); TCanvas* c2 = new TCanvas("c2","c2",1500,1000);
c2->Divide(2); c2->Divide(4);
c2->cd(1); c2->cd(1);
hDE_E->Draw(); hDE_E->Draw();
c2->cd(2); c2->cd(2);
hDE_Ecorr->Draw(); hDE_Ecorr->Draw();
c2->cd(3);
hDEBis_Ecorr->Draw();
c2->cd(4);
hDE_E_IC1_Corr->Draw();
} // End spline chio XY } // End spline chio XY
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