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

Streamlined drawing of histogram in SplineChioXY

parent a39d8141
No related branches found
No related tags found
1 merge request!27Draft: [Epic] Preparation of the environement for the new GaseousDetectorScorers...
Pipeline #362131 passed
......@@ -15,6 +15,7 @@ using namespace std;
TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee, double XMin , double
XMax, double YMin, double YMax);
void HistoFiller();
void HistoDrawer(vector<TH2F*> h);
//////////////////////////////////////////////////////////////////////////////////////////
void SplineChioXY( bool Create = false) {
......@@ -25,7 +26,7 @@ void SplineChioXY( bool Create = false) {
cout << "Creating Histo.root" << endl;
HistoFiller(); //Deactivated after one launch of the macro
cout << "Histo.root created and loaded" << endl ;
}
}
else if (inFile && !inFile->IsZombie()) {
......@@ -33,7 +34,7 @@ void SplineChioXY( bool Create = false) {
}
else {
cerr << "Make your mind" << endl;
cerr << "Make your mind" << endl;
}
......@@ -42,6 +43,11 @@ void SplineChioXY( bool Create = false) {
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"));
hIC.push_back((TH2F*)inFile->Get("hChio_IC0_X"));
hIC.push_back((TH2F*)inFile->Get("hChio_IC0_Y"));
HistoDrawer(hIC);
TFile* fspline = new TFile("Output/spline_Chio_2024.root", "recreate");
......@@ -51,14 +57,17 @@ void SplineChioXY( bool Create = false) {
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 ;
XMin[4] = -520 ; XMax[4] = 380 ; YMin[4] = 2000 ; YMax[4] = 9500 ;
XMin[5] = -70 ; XMax[5] = 79 ; YMin[5] = 2000 ; YMax[5] = 9500 ;
for (int i = 0; i < hIC.size(); i++) {
for (int i = 0; i < NHist; i++) {
TSpline3* spline = MakeSpline(hIC[i] , i, XMin[i] , XMax[i], YMin[i], YMax[i]);
if (i < 2) spline->SetName(Form("fsplineIC0_%d", i ));
else if (i>=2) spline->SetName(Form("fsplineIC1_%d",i));
if (i < 2) spline->SetName(Form("fsplineIC01_%d", i ));
else if (i>=2 && i<4) spline->SetName(Form("fsplineIC1_%d",i));
else if (i>=4) spline->SetName(Form("fsplineIC0_%d",i));
spline->Write();
} //End loop on histogram
......@@ -101,6 +110,10 @@ void HistoFiller() {
"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);
TH2F* hChio_IC0_X = new TH2F("hChio_IC0_X",
"hChio_IC0_X", 1000, -800, 800, 500, 2000, 9500);
TH2F* hChio_IC0_Y = new TH2F("hChio_IC0_Y",
"hChio_IC0_Y", 1000, -160, 160, 500, 2000, 9500);
......@@ -126,13 +139,15 @@ void HistoFiller() {
}
//if (IC->Eres>11000 && IC->Eres < 12000){
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_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]);
hChio_IC1_X->Fill(FF_IC_X, fIC_raw[1]);
hChio_IC1_Y->Fill(FF_IC_Y, fIC_raw[1]);
hChio_IC0_X->Fill(FF_IC_X, fIC_raw[0]);
hChio_IC0_Y->Fill(FF_IC_Y, fIC_raw[0]);
//}
// 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
......@@ -140,28 +155,13 @@ void HistoFiller() {
// Output Canvas and files
//===========================================================================================================
TCanvas* canX = new TCanvas("X", "X", 0, 0, 2000, 1000);
canX->cd();
hChio_IC0_IC1_X_all->Draw("colz");
TCanvas* canY = new TCanvas("Y", "Y", 0, 0, 2000, 1000);
canY->cd();
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");
hChio_IC0_IC1_X_all->Write();
hChio_IC0_IC1_Y_all->Write();
hChio_IC1_Y->Write();
hChio_IC1_X->Write();
hChio_IC0_X->Write();
hChio_IC0_Y->Write();
outFile->Close();
} // End HistoFiller
......@@ -261,3 +261,25 @@ TSpline3* MakeSpline(TH2F* hInput, Int_t NCallee, double XMin = 0 , double
return gspline;
} // end makespline
void HistoDrawer(vector<TH2F*> h){
int NHisto = static_cast<int>(h.size());
TCanvas* CanX= new TCanvas("CanX","CanX",0,0,2000,1000);
TCanvas* CanY= new TCanvas("CanY","CanY",0,0,2000,1000);
CanX->Divide(NHisto/2);
CanY->Divide(NHisto/2);
for ( int i=0 ; i < NHisto ; i+=2 ){
//All x are even and all y are odd
int CanvaNumber = (i+1)/2 + 1 ;
CanX->cd(CanvaNumber);
h[i]->Draw("colz");
CanY->cd(CanvaNumber);
h[i+1]->Draw("colz");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment