From 0e22c565846634ea6b343f2a05cea4d2ee86fc0c Mon Sep 17 00:00:00 2001
From: Carlos Yero <cyero002@fiu.edu>
Date: Wed, 8 Mar 2017 13:50:28 -0500
Subject: [PATCH] added option to read in the run number from an input text
 file

---
 CALIBRATION/shms_dc_calib/scripts/wire_drift_times.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.h b/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.h
index 0e6c0b22..42c297d5 100644
--- a/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.h
+++ b/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.h
@@ -324,9 +324,14 @@ wire_drift_times::wire_drift_times(TTree *tree) : fChain(0)
 // if parameter tree is not specified (or zero), connect the file
 // used to generate this class and read the Tree.
    if (tree == 0) {
-      TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("../../../ROOTfiles/shms_replay_437.root");
+     int run_NUM;
+     TString f0 = "input_RUN.txt";
+     ifstream  infile(f0);
+     infile >> run_NUM;
+
+     TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject(Form("../../../ROOTfiles/shms_replay_%d.root", run_NUM));
       if (!f || !f->IsOpen()) {
-         f = new TFile("../../../ROOTfiles/shms_replay_437.root");
+	f = new TFile(Form("../../../ROOTfiles/shms_replay_%d.root", run_NUM));
       }
       f->GetObject("T",tree);
 
-- 
GitLab