Skip to content
Snippets Groups Projects
Commit 34171c81 authored by Maria Zurek's avatar Maria Zurek
Browse files

Adjust automatically the axis ranges

parent 44b44a6c
No related branches found
No related tags found
1 merge request!153Draft: Resolve "Add energy scan for Barrel Ecal"
...@@ -107,7 +107,7 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -107,7 +107,7 @@ std::tuple <double, double, double, double, double, double, double, double> extr
// Define variables // Define variables
auto d1 = d0.Define("Ethr", Ethr, {"mcparticles2"}) auto d1 = d0.Define("Ethr", Ethr, {"mcparticles2"})
.Define("ErecImg", Erec, {"RecoEcalBarrelHits"}) .Define("ErecImg", Erec, {"RecoEcalBarrelImagingHits"})
.Define("ErecScFi", Erec, {"EcalBarrelScFiHitsReco"}) .Define("ErecScFi", Erec, {"EcalBarrelScFiHitsReco"})
.Define("EdigiImg", Edigi, {"DigiEcalBarrelHits"}) .Define("EdigiImg", Edigi, {"DigiEcalBarrelHits"})
.Define("EdigiScFi", Edigi, {"EcalBarrelScFiHitsDigi"}) .Define("EdigiScFi", Edigi, {"EcalBarrelScFiHitsDigi"})
...@@ -123,18 +123,18 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -123,18 +123,18 @@ std::tuple <double, double, double, double, double, double, double, double> extr
// Define Histograms // Define Histograms
auto hEthr = d1.Histo1D({"hEthr", "Thrown Energy; Thrown Energy [GeV]; Events", 100, 0.0, 25.0},"Ethr"); auto hEthr = d1.Histo1D({"hEthr", "Thrown Energy; Thrown Energy [GeV]; Events", 100, 0.0, 25.0},"Ethr");
auto hEdigiImg = d1.Histo1D({"hEdigiImg", "Digi energy deposit; Amplitude [QCD]; Events", 1000, 0, 200000},"EdigiImg").GetPtr(); auto hEdigiImg = d1.Histo1D({"hEdigiImg", "Digi energy deposit; Amplitude [QCD]; Events", 1000, 0, 200000},"EdigiImg").GetPtr();
auto hErecImg = d1.Histo1D({"hErecImg", "Reconstructed energy deposit; Energy Deposit [GeV]; Events", 500, 0.0, 0.5},"ErecImg"); auto hErecImg = d1.Histo1D({"hErecImg", "Reconstructed energy deposit; Energy Deposit [GeV]; Events", 500, 0.0, 0.5},"ErecImg").GetPtr();
auto hEClusterImg = d1.Histo1D({"hEClusterImg", "Cluster Energy; Cluster Energy [GeV]; Events", 200, 0.0, 25.0},"EClusterImg"); auto hEClusterImg = d1.Histo1D({"hEClusterImg", "Cluster Energy; Cluster Energy [GeV]; Events", 200, 0.0, 25.0},"EClusterImg").GetPtr();
auto hNClusterImg = d1.Histo1D({"hNClusterImg", "Number of Clusters; # of Clusters; Events", 100, 0.0, 100.0}, "NClusterImg"); auto hNClusterImg = d1.Histo1D({"hNClusterImg", "Number of Clusters; # of Clusters; Events", 100, 0.0, 100.0}, "NClusterImg").GetPtr();
auto hfsamImg = d1.Histo1D({"hfsamImg", "Cluster Energy/E true; Cluster Energy/E true; Events", 100, 0.0, 1.5},"fsamClusterImg"); auto hfsamImg = d1.Histo1D({"hfsamImg", "Cluster Energy/E true; Cluster Energy/E true; Events", 100, 0.0, 1.5},"fsamClusterImg").GetPtr();
auto hfsamRecImg = d1.Histo1D({"hfsamRecImg", "Reco Hits Energy/E true; Reco Hits Energy/E true; Events", 50, 0.0, 0.1},"fsamRecImg"); auto hfsamRecImg = d1.Histo1D({"hfsamRecImg", "Reco Hits Energy/E true; Reco Hits Energy/E true; Events", 50, 0.0, 0.1},"fsamRecImg").GetPtr();
auto hErecScFi = d1.Histo1D({"hErecScFi", "Reconstructed energy deposit; Energy Deposit [GeV]; Events", 500, 0.0, 15.0},"ErecScFi"); auto hErecScFi = d1.Histo1D({"hErecScFi", "Reconstructed energy deposit; Energy Deposit [GeV]; Events", 500, 0.0, 15.0},"ErecScFi").GetPtr();
auto hEdigiScFi = d1.Histo1D({"hEdigiScFi", "Digi energy deposit; Amplitude [QCD]; Events", 1000, 0, 200000},"EdigiScFi"); auto hEdigiScFi = d1.Histo1D({"hEdigiScFi", "Digi energy deposit; Amplitude [QCD]; Events", 1000, 0, 200000},"EdigiScFi").GetPtr();
auto hEClusterScFi = d1.Histo1D({"hEClusterScFi", "Cluster Energy; Cluster Energy [GeV]; Events", 500, 0.0, 25.0},"EClusterScFi"); auto hEClusterScFi = d1.Histo1D({"hEClusterScFi", "Cluster Energy; Cluster Energy [GeV]; Events", 500, 0.0, 25.0},"EClusterScFi").GetPtr();
auto hNClusterScFi = d1.Histo1D({"hNClusterScFi", "Number of Clusters; # of Clusters; Events", 100, 0.0, 100.0}, "NClusterScFi"); auto hNClusterScFi = d1.Histo1D({"hNClusterScFi", "Number of Clusters; # of Clusters; Events", 100, 0.0, 100.0}, "NClusterScFi").GetPtr();
auto hfsamScFi = d1.Histo1D({"hfsamScFi", "Cluster Energy/E true; Cluster Energy/E true; Events", 100, 0.8, 1.2},"fsamClusterScFi"); auto hfsamScFi = d1.Histo1D({"hfsamScFi", "Cluster Energy/E true; Cluster Energy/E true; Events", 100, 0.8, 1.2},"fsamClusterScFi").GetPtr();
auto hfsamRecScFi = d1.Histo1D({"hfsamRecScFi", "Reco Hits Energy/E true; Reco Hits Energy/E true; Events", 50, 0.0, 0.25},"fsamRecScFi"); auto hfsamRecScFi = d1.Histo1D({"hfsamRecScFi", "Reco Hits Energy/E true; Reco Hits Energy/E true; Events", 50, 0.0, 0.25},"fsamRecScFi").GetPtr();
// Event Counts // Event Counts
auto nevents_thrown = d1.Count(); auto nevents_thrown = d1.Count();
...@@ -162,20 +162,21 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -162,20 +162,21 @@ std::tuple <double, double, double, double, double, double, double, double> extr
hEdigiScFi->GetYaxis()->SetTitleOffset(1.4); hEdigiScFi->GetYaxis()->SetTitleOffset(1.4);
hEdigiScFi->SetLineWidth(2); hEdigiScFi->SetLineWidth(2);
hEdigiScFi->SetLineColor(kBlue); hEdigiScFi->SetLineColor(kBlue);
set_histo_range(hEdigiScFi);
hEdigiScFi->DrawClone(); hEdigiScFi->DrawClone();
//set_histo_range(hEdigiScFi->GetPtr());
c2->cd(3); c2->cd(3);
hErecImg->GetYaxis()->SetTitleOffset(1.4); hErecImg->GetYaxis()->SetTitleOffset(1.4);
hErecImg->SetLineWidth(2); hErecImg->SetLineWidth(2);
hErecImg->SetLineColor(kBlue); hErecImg->SetLineColor(kBlue);
hErecImg->DrawClone(); hErecImg->DrawClone();
//set_histo_range(hErecImg->GetPtr()); set_histo_range(hErecImg);
c2->cd(4); c2->cd(4);
hErecScFi->GetYaxis()->SetTitleOffset(1.4); hErecScFi->GetYaxis()->SetTitleOffset(1.4);
hErecScFi->SetLineWidth(2); hErecScFi->SetLineWidth(2);
hErecScFi->SetLineColor(kBlue); hErecScFi->SetLineColor(kBlue);
set_histo_range(hErecScFi);
hErecScFi->DrawClone(); hErecScFi->DrawClone();
//set_histo_range(hErecScFi->GetPtr());
save_canvas(c2, "E_digi_rec", E_label, particle_label); save_canvas(c2, "E_digi_rec", E_label, particle_label);
{ {
TCanvas* c3 = new TCanvas("c3", "c3", 1400, 500); TCanvas* c3 = new TCanvas("c3", "c3", 1400, 500);
...@@ -184,14 +185,16 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -184,14 +185,16 @@ std::tuple <double, double, double, double, double, double, double, double> extr
hfsamRecImg->GetYaxis()->SetTitleOffset(1.4); hfsamRecImg->GetYaxis()->SetTitleOffset(1.4);
hfsamRecImg->SetLineWidth(2); hfsamRecImg->SetLineWidth(2);
hfsamRecImg->SetLineColor(kBlue); hfsamRecImg->SetLineColor(kBlue);
set_histo_range(hfsamRecImg);
hfsamRecImg->DrawClone(); hfsamRecImg->DrawClone();
//set_histo_range(hfsamRecImg->GetPtr());
c3->cd(2); c3->cd(2);
hfsamRecScFi->GetYaxis()->SetTitleOffset(1.4); hfsamRecScFi->GetYaxis()->SetTitleOffset(1.4);
hfsamRecScFi->SetLineWidth(2); hfsamRecScFi->SetLineWidth(2);
hfsamRecScFi->SetLineColor(kBlue); hfsamRecScFi->SetLineColor(kBlue);
set_histo_range(hfsamRecScFi);
hfsamRecScFi->DrawClone(); hfsamRecScFi->DrawClone();
//set_histo_range(hfsamRecScFi->GetPtr());
save_canvas(c3, "fsam_digi_rec", E_label, particle_label); save_canvas(c3, "fsam_digi_rec", E_label, particle_label);
} }
{ {
...@@ -199,8 +202,9 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -199,8 +202,9 @@ std::tuple <double, double, double, double, double, double, double, double> extr
hEClusterScFi->GetYaxis()->SetTitleOffset(1.4); hEClusterScFi->GetYaxis()->SetTitleOffset(1.4);
hEClusterScFi->SetLineWidth(2); hEClusterScFi->SetLineWidth(2);
hEClusterScFi->SetLineColor(kBlue); hEClusterScFi->SetLineColor(kBlue);
set_histo_range(hEClusterScFi);
hEClusterScFi->DrawClone(); hEClusterScFi->DrawClone();
//set_histo_range(hEClusterScFi->GetPtr());
save_canvas(c5, "EClusterSCFi", E_label, particle_label); save_canvas(c5, "EClusterSCFi", E_label, particle_label);
} }
{ {
...@@ -209,13 +213,13 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -209,13 +213,13 @@ std::tuple <double, double, double, double, double, double, double, double> extr
hEClusterImg->GetYaxis()->SetTitleOffset(1.4); hEClusterImg->GetYaxis()->SetTitleOffset(1.4);
hEClusterImg->SetLineWidth(2); hEClusterImg->SetLineWidth(2);
hEClusterImg->SetLineColor(kBlue); hEClusterImg->SetLineColor(kBlue);
set_histo_range(hEClusterImg);
hEClusterImg->DrawClone(); hEClusterImg->DrawClone();
//set_histo_range(hEClusterImg->GetPtr());
save_canvas(c6, "EClusterImg", E_label, particle_label); save_canvas(c6, "EClusterImg", E_label, particle_label);
} }
{
TCanvas* c8 = new TCanvas("c8", "c8", 700, 500); TCanvas* c8 = new TCanvas("c8", "c8", 700, 500);
hfsamImg->DrawClone();
hfsamImg->GetYaxis()->SetTitleOffset(1.4); hfsamImg->GetYaxis()->SetTitleOffset(1.4);
hfsamImg->SetLineWidth(2); hfsamImg->SetLineWidth(2);
hfsamImg->SetLineColor(kBlue); hfsamImg->SetLineColor(kBlue);
...@@ -223,7 +227,7 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -223,7 +227,7 @@ std::tuple <double, double, double, double, double, double, double, double> extr
double down_fit = hfsamImg->GetMean() - 5*hfsamImg->GetStdDev(); double down_fit = hfsamImg->GetMean() - 5*hfsamImg->GetStdDev();
if(down_fit <=0 ) down_fit = hfsamImg->GetXaxis()->GetBinUpEdge(1); if(down_fit <=0 ) down_fit = hfsamImg->GetXaxis()->GetBinUpEdge(1);
hfsamImg->Fit("gaus", "", "", down_fit, up_fit); hfsamImg->Fit("gaus", "", "", down_fit, up_fit);
//set_histo_range(hfsamImg->GetPtr()); set_histo_range(hfsamImg);
TF1 *gausImg = hfsamImg->GetFunction("gaus"); TF1 *gausImg = hfsamImg->GetFunction("gaus");
gausImg->SetLineWidth(2); gausImg->SetLineWidth(2);
gausImg->SetLineColor(kRed); gausImg->SetLineColor(kRed);
...@@ -231,10 +235,11 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -231,10 +235,11 @@ std::tuple <double, double, double, double, double, double, double, double> extr
double sigmaImg = gausImg->GetParameter(2); double sigmaImg = gausImg->GetParameter(2);
double meanImg_err = gausImg->GetParError(1); double meanImg_err = gausImg->GetParError(1);
double sigmaImg_err = gausImg->GetParError(2); double sigmaImg_err = gausImg->GetParError(2);
hfsamImg->DrawClone();
save_canvas(c8, "fsamClusterImg", E_label, particle_label); save_canvas(c8, "fsamClusterImg", E_label, particle_label);
}
{
TCanvas* c7 = new TCanvas("c7", "c7", 700, 500); TCanvas* c7 = new TCanvas("c7", "c7", 700, 500);
hfsamScFi->DrawClone();
hfsamScFi->GetYaxis()->SetTitleOffset(1.4); hfsamScFi->GetYaxis()->SetTitleOffset(1.4);
hfsamScFi->SetLineWidth(2); hfsamScFi->SetLineWidth(2);
hfsamScFi->SetLineColor(kBlue); hfsamScFi->SetLineColor(kBlue);
...@@ -243,7 +248,7 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -243,7 +248,7 @@ std::tuple <double, double, double, double, double, double, double, double> extr
down_fit = hfsamScFi->GetMean() - 5*hfsamScFi->GetStdDev(); down_fit = hfsamScFi->GetMean() - 5*hfsamScFi->GetStdDev();
if(down_fit <=0 ) down_fit = hfsamScFi->GetXaxis()->GetBinUpEdge(1); if(down_fit <=0 ) down_fit = hfsamScFi->GetXaxis()->GetBinUpEdge(1);
hfsamScFi->Fit("gaus", "", "", down_fit, up_fit); hfsamScFi->Fit("gaus", "", "", down_fit, up_fit);
//set_histo_range(hfsamScFi->GetPtr()); set_histo_range(hfsamScFi);
TF1 *gaus = hfsamScFi->GetFunction("gaus"); TF1 *gaus = hfsamScFi->GetFunction("gaus");
gaus->SetLineWidth(2); gaus->SetLineWidth(2);
gaus->SetLineColor(kRed); gaus->SetLineColor(kRed);
...@@ -251,9 +256,10 @@ std::tuple <double, double, double, double, double, double, double, double> extr ...@@ -251,9 +256,10 @@ std::tuple <double, double, double, double, double, double, double, double> extr
double sigmaScFi = gaus->GetParameter(2); double sigmaScFi = gaus->GetParameter(2);
double meanScFi_err = gaus->GetParError(1); double meanScFi_err = gaus->GetParError(1);
double sigmaScFi_err = gaus->GetParError(2); double sigmaScFi_err = gaus->GetParError(2);
hfsamScFi->DrawClone();
save_canvas(c7, "fsamClusterScFi", E_label, particle_label); save_canvas(c7, "fsamClusterScFi", E_label, particle_label);
return std::make_tuple(meanScFi, sigmaScFi, meanScFi_err, sigmaScFi_err, meanImg, sigmaImg, meanImg_err, sigmaImg_err); return std::make_tuple(meanScFi, sigmaScFi, meanScFi_err, sigmaScFi_err, meanImg, sigmaImg, meanImg_err, sigmaImg_err);
}
} }
std::vector<std::string> read_scanned_energies(std::string input_energies_fname) std::vector<std::string> read_scanned_energies(std::string input_energies_fname)
......
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