From 53938fc00440c58ece3701276fb8ba35370523ab Mon Sep 17 00:00:00 2001
From: Yero1990 <cyero002@fiu.edu>
Date: Sun, 18 Jun 2017 16:34:39 -0400
Subject: [PATCH] Dc calib (#148)

* minor fixes to shms dc calib

* Changed the binning scheme in the shms calibrations such that at 0 ns (tzero-corrected) will be centerd about its corresponding bin, and not at an edge.
---
 .../shms_dc_calib/scripts/get_pdc_time_histo.C        |  5 +++--
 .../scripts/get_pdc_time_histo_tzero_corrected_v2.C   |  4 +++-
 CALIBRATION/shms_dc_calib/scripts/wire_drift_times.C  | 11 +++++++----
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo.C b/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo.C
index d2689e11..6bb64537 100644
--- a/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo.C
+++ b/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo.C
@@ -3,7 +3,8 @@
 
 #define NPLANES 12
 #define NBINS 400
-
+#define bin_min -50.5
+#define bin_max 349.5
 void get_pdc_time_histo()
 {
 
@@ -58,7 +59,7 @@ void get_pdc_time_histo()
   
   
     //Create Histograms
-    h[ip] = new TH1F(drift_time_histo, title, NBINS, -50, 350);  //set time to 400 ns/200 bins = 2ns/bin
+    h[ip] = new TH1F(drift_time_histo, title, NBINS, bin_min, bin_max);  //set time to 400 ns/200 bins = 2ns/bin
     h[ip]->GetXaxis()->SetTitle("Drift Time (ns)");
     h[ip]->GetYaxis()->SetTitle("Number of Entries / 1 ns");
   }
diff --git a/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo_tzero_corrected_v2.C b/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo_tzero_corrected_v2.C
index 8feed031..a407ba19 100644
--- a/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo_tzero_corrected_v2.C
+++ b/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo_tzero_corrected_v2.C
@@ -3,6 +3,8 @@
 
 #define NPLANES 12
 #define NBINS 400
+#define bin_min -50.5
+#define bin_max 349.5
 
 void get_pdc_time_histo_tzero_corrected_v2()
 {
@@ -158,7 +160,7 @@ void get_pdc_time_histo_tzero_corrected_v2()
   
   
     //Create Histograms
-    h[ip] = new TH1F(drift_time_histo, title, NBINS, -50, 350);  //set time to 400 ns/200 bins = 2ns/bin
+    h[ip] = new TH1F(drift_time_histo, title, NBINS, bin_min, bin_max);  //set time to 400 ns/200 bins = 2ns/bin
     h[ip]->GetXaxis()->SetTitle("Drift Time (ns)");
     h[ip]->GetYaxis()->SetTitle("Number of Entries / 1 ns");
   }
diff --git a/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.C b/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.C
index 8b38a8f4..fc7d9d5a 100644
--- a/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.C
+++ b/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.C
@@ -3,8 +3,11 @@
 #include <TH2.h>
 #include <TStyle.h>
 #include <TCanvas.h>
+
 #define NPLANES 12
 #define NBINS 400
+#define bin_min -50.5
+#define bin_max 349.5
 void wire_drift_times::Loop()
 {
   //   In a ROOT session, you can do:
@@ -76,7 +79,7 @@ void wire_drift_times::Loop()
     if(ip == 0 || ip == 1 || ip == 4 || ip == 5 || ip == 6 || ip == 7 || ip == 10 || ip == 11) {
 
       TH1F *cell_dt[total_wires_uv];    
-      TH2F *drifttime_vs_wire = new TH2F("drifttime_vs_wire", "", 107., 0.,107., NBINS, -50., 350.);
+      TH2F *drifttime_vs_wire = new TH2F("drifttime_vs_wire", "", 107., 0.,107., NBINS, bin_min, bin_max);
       
      
     
@@ -85,7 +88,7 @@ void wire_drift_times::Loop()
 
       //Initialize wire drift time histograms
       for (wirenum=1; wirenum<=total_wires_uv; wirenum++){
-	cell_dt[wirenum-1] = new TH1F(Form("wire_%d", wirenum), "", NBINS, -50., 350.);
+	cell_dt[wirenum-1] = new TH1F(Form("wire_%d", wirenum), "", NBINS, bin_min, bin_max);
                 
       cell_dt[wirenum-1]->GetXaxis()->SetTitle("Drift Time (ns)");
       cell_dt[wirenum-1]->GetYaxis()->SetTitle("Number of Entries / 1 ns");
@@ -210,7 +213,7 @@ void wire_drift_times::Loop()
     if(ip == 2 || ip == 3 || ip == 8 || ip == 9) {
 
       TH1F *cell_dt[total_wires_x];    
-      TH2F *drifttime_vs_wire = new TH2F("drifttime_vs_wire", "", 79., 0., 79., NBINS, -50., 350.);
+      TH2F *drifttime_vs_wire = new TH2F("drifttime_vs_wire", "", 79., 0., 79., NBINS, bin_min, bin_max);
  
             
   
@@ -219,7 +222,7 @@ void wire_drift_times::Loop()
 
       //Initialize wire drift time histograms
       for (int wirenum=1; wirenum<=total_wires_x; wirenum++){
-	cell_dt[wirenum-1] = new TH1F(Form("wire_%d", wirenum), "", NBINS, -50., 350.);
+	cell_dt[wirenum-1] = new TH1F(Form("wire_%d", wirenum), "", NBINS, bin_min, bin_max);
   
 	cell_dt[wirenum-1]->GetXaxis()->SetTitle("Drift Time (ns)");
 	cell_dt[wirenum-1]->GetYaxis()->SetTitle("Number of Entries / 1 ns");
-- 
GitLab