From 63320f5ac12f3cf29c175fc1e9f2a5aadee9102a Mon Sep 17 00:00:00 2001
From: Marshall Scott <mbscott@anl.gov>
Date: Tue, 27 Apr 2021 21:53:26 -0400
Subject: [PATCH] plotting charge

---
 .../scripts/emcal_barrel_pions_analysis.cxx       | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx b/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx
index c0bce354..b7fadcdd 100644
--- a/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx
+++ b/benchmarks/barrel_ecal/scripts/emcal_barrel_pions_analysis.cxx
@@ -53,16 +53,17 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal
        {"quantity", "resolution (in %)"},
        {"target", std::to_string(resolutionTarget)}}};
 */
-  //gSystem->Exec("cp sim_output/sim_emcal_barrel_uniform_pions.root results/sim_emcal_barrel_uniform_pions.root");
+
   ROOT::EnableImplicitMT();
   ROOT::RDataFrame d0("events", input_fname);
-
+/*
   auto colNames = d0.GetColumnNames();
 
   ofstream out;
   out.open("results/column_list.txt");
   for (auto &&col : colNames){out << col << endl; cout << col << endl;}
   out.close();
+  */
 
   // Thrown Energy [GeV]
   auto Ethr = [](std::vector<dd4pod::Geant4ParticleData> const& input) {
@@ -135,6 +136,7 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal
         .Define("fsam",   fsam2,      {"Esim","Ethr"})
         .Define("dE",     eResol,     {"Esim", "Ethr"})
         .Define("dE_rel", eResol_rel, {"Esim", "Ethr"})
+        .Define("charge", {"charge"})
 	      ;
 
   // Define Histograms
@@ -142,6 +144,7 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal
   auto hNhits = d1.Histo1D({"hNhits", "Number of hits per events; Number of hits; Events", 100,  0.0, 2000.0}, "nhits");
   auto hEsim  = d1.Histo1D({"hEsim",  "Energy Deposit; Energy Deposit [GeV]; Events",      100,  0.0,    1.0}, "Esim");
   auto hfsam  = d1.Histo1D({"hfsam",  "Sampling Fraction; Sampling Fraction; Events",      100,  0.0,    0.1}, "fsam");
+  auto hcharge = d1.Histo1D({"hcharge", "charge; charge; Count", 10, -2, 2}, "charge");
 
   // Event Counts
   auto nevents_thrown      = d1.Count();
@@ -187,6 +190,14 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal
   c4->SaveAs("results/emcal_barrel_pions_fsam.png");
   c4->SaveAs("results/emcal_barrel_pions_fsam.pdf");
 
+  TCanvas *c5 = new TCanvas("c5", "c5", 700, 500);
+  hcharge->GetYaxis()->SetTitleOffset(1.4);
+  hcharge->SetLineWidth(2);
+  hcharge->SetLineColor(kBlue);
+  hcharge->DrawClone();
+  c5->SaveAs("results/emcal_barrel_pions_charge.png");
+  c5->SaveAs("results/emcal_barrel_pions_chage.pdf");
+
   //Energy Resolution Work
   auto hdE          = d1.Histo1D({"hdE",      "dE; dE[GeV]; Events",              20, -7.5, 7.5}, "dE");//changed from 100
   auto hdE_rel      = d1.Histo1D({"hdE_rel",  "dE Relative; dE Relative; Events", 20, -7.5, 7.5}, "dE_rel");//changed from 100
-- 
GitLab