diff --git a/.gitignore b/.gitignore
index af9f75b65f72da3dec4e8dc38db0b288b8b447c9..5d640234a9fd38edef2a14a1fc019c388f974dac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,6 @@ ROOTfiles/*
 hcana
 raw
 .root_history
+data_files/*
+root_files/*
 REPORT_OUTPUT/*
diff --git a/CALIBRATION/shms_dc_calib/run_Cal.C b/CALIBRATION/shms_dc_calib/run_Cal.C
new file mode 100644
index 0000000000000000000000000000000000000000..8d08d80b9207fc7702ae5f524c4912bb847c60e1
--- /dev/null
+++ b/CALIBRATION/shms_dc_calib/run_Cal.C
@@ -0,0 +1,68 @@
+//SCRIPT TO RUN OVER ALL HMS DC CALIBRATION SCRIPTS AT ONCE, AND UPDATE THE
+//NECESSARY PARAMTER FILES hdriftmap.param and  hdc.param
+void run_Cal()
+{
+      
+  //User Input Run
+  int run_NUM;
+  cout << "Enter Run Number: " << endl;
+  cin >> run_NUM;
+
+  //Create input file with run number
+  ofstream fout;
+  fout.open("scripts/input_RUN.txt");
+  fout << run_NUM << endl;
+  fout.close();
+
+
+  //Create root and data files Directories if they dont exist
+  char *dir_root = "mkdir ./root_files/";
+  char *dir_data = "mkdir ./data_files/";
+
+  if (system(dir_root || dir_data) != 0) {
+    system(dir_root);
+    system(dir_data);
+  }
+
+  //Create run Directories if they dont exist
+  char *dir0 = Form("mkdir ./root_files/run%d", run_NUM);
+  char *dir1 = Form("mkdir ./data_files/run%d", run_NUM);
+
+  if (system(dir0 || dir1) != 0) {
+    system(dir0);
+    system(dir1);
+  }
+
+  
+
+  //change directories and execute scripts
+  gSystem->cd("./scripts");
+  gSystem->Exec("root -l -q get_pdc_time_histo.C");
+  
+  //Load and Loop over Make Class events to get individual drift times
+  gROOT->LoadMacro("wire_drift_times.C");
+  gROOT->ProcessLine("wire_drift_times t"); //process line allows one to execute interactive root commands from a script, such as this one
+  gROOT->ProcessLine("t.Loop()");
+  //gROOT->ProcessLine(".q");
+  gROOT->Reset();
+  
+  
+
+gSystem->cd("./scripts");
+
+  
+  //execute code to get t0 from each wire in each plane
+  gSystem->Exec("root -l -q -b get_wire_tzero.C");
+ 
+  //execute code to update pdc parameter file
+  gSystem->Exec("root -l -q update_pdcparam.C");
+
+  //execute code to get t0 corrected drift times
+  gSystem->Exec("root -l -q get_pdc_time_histo_tzero_corrected.C");
+  
+ //execute code to update LookUp Table
+  gSystem->Exec("root -l -q get_LookUp_Values.C");
+
+  
+  
+}
diff --git a/CALIBRATION/shms_dc_calib/scripts/get_LookUp_Values.C b/CALIBRATION/shms_dc_calib/scripts/get_LookUp_Values.C
new file mode 100644
index 0000000000000000000000000000000000000000..52f7457e72daa46773b22b927eff759f93b205de
--- /dev/null
+++ b/CALIBRATION/shms_dc_calib/scripts/get_LookUp_Values.C
@@ -0,0 +1,126 @@
+/*This code produces a lookup table necessary to convert drift times to
+  drift distances in the shms drift chambers
+*/
+
+#define NPLANES 12
+#define TOTAL_BINS 137
+
+void get_LookUp_Values() {
+
+   
+  //Read Run Number from txt file
+  int run_NUM;
+  TString f0 = "input_RUN.txt";
+  ifstream infile(f0);
+  infile >> run_NUM;
+ 
+  //Open root file containing drift time histos
+  TFile *f = new TFile(Form("../root_files/run%d/shms_dc_t0_corrected_%d.root", run_NUM, run_NUM),"READ");
+ 
+  //Define histogram array
+  TH1F *h[NPLANES];
+ 
+  //Define the number Drift Chamber planes
+  TString plane_names[NPLANES]={"1u1", "1u2", "1x1", "1x2", "1v1", "1v2", "2v2", "2v1", "2x2", "2x1", "2u2", "2u1"};
+ 
+  //Declare bin properties
+  int bin_t0[NPLANES];
+  int bin_final[NPLANES];					/*Array to store the bin number corresponding to last bin*/
+  int bin_Content[NPLANES];          /*Array to store the content (# events) corresponding to the bin with maximum content*/
+  double binContent_TOTAL[NPLANES];     /*Array to store sum of all bin contents for each plane*/
+  double binSUM[NPLANES];
+  int bin;
+  int binx;
+  double lookup_value[NPLANES];           /*Array to store lookup values for each plane*/ 
+  
+  //Create an output file to store lookup values  
+  ofstream ofs;
+  TString lookup_table = "../../../PARAM/SHMS/DC/pdriftmap_new.param";
+  ofs.open (lookup_table);
+ 
+ 
+  //Set headers for subsequent columns of data
+  ofs << Form("; Lookup Table: RUN %d", run_NUM) << "\n";
+  ofs << "; number of bins in Carlos's time to distance lookup table" << "\n";
+  ofs << Form("pdriftbins = %d", TOTAL_BINS+1) << "\n";
+  ofs << "; number of 1st bin in Carlos's table in ns" << "\n";
+  ofs << "pdrift1stbin=0" << "\n";
+  ofs << "; bin size in ns" << "\n";
+  ofs << "pdriftbinsz=2" << "\n";
+ 
+ 
+ 
+  //Loop over each plane of shms Drift Chambers (DC1 & DC2)
+
+  for (int ip=0; ip<NPLANES; ip++){
+   
+    TString drift_time_histo = "pdc"+plane_names[ip]+"_time: t0_corr"; 
+
+    //Get drift time histograms from root file
+    h[ip] = (TH1F*)f->Get(drift_time_histo);
+
+    //Get bin corresponding to t0 = 0 ns
+    bin_t0[ip] = h[ip]->GetXaxis()->FindBin(0.0);
+   
+    //Get final bin 
+    bin_final[ip] = bin_t0[ip] + TOTAL_BINS;
+   
+   
+   
+    //Find total BIN Content over entire integration range
+    binContent_TOTAL[ip] = 0; //set counter to zero
+
+    for (bin = bin_t0[ip]; bin <= bin_final[ip]; bin ++ ) {
+     
+      bin_Content[ip] = h[ip] -> GetBinContent(bin);
+     
+      binContent_TOTAL[ip] = bin_Content[ip] + binContent_TOTAL[ip];
+     
+      //   cout << "Bin: " << bin << endl;
+      //   cout << "Content " << bin_Content[ip] << endl;
+      //   cout << "Content SUM : " << binContent_TOTAL[ip] << endl;
+    }
+   
+    TString headers = "pwc" + plane_names[ip] + "fract=";      
+    ofs << headers;	  
+   
+    //Calculate LookUp Value
+   
+    binSUM[ip] = 0.0;
+    int bin_count = 0;
+   
+    for (bin = bin_t0[ip]; bin <= bin_final[ip]; bin++) {
+     
+      bin_Content[ip] = h[ip] -> GetBinContent(bin);
+      binSUM[ip] = binSUM[ip] + bin_Content[ip];
+     
+     
+      lookup_value[ip] = binSUM[ip] / binContent_TOTAL[ip];
+      bin_count = bin_count + 1;
+     
+      if (bin_count < = 8 ) {
+	ofs << setprecision(5) << lookup_value[ip] << fixed << ",";
+      }
+     
+      else if (bin_count >8 && bin_count < 138) {
+	ofs << setprecision(5) << lookup_value[ip] << ((bin_count+1) % 10 ? "," : "\n") << fixed; 
+      }
+      else {
+	ofs << setprecision(5) << lookup_value[ip] << fixed << endl;	  
+      }
+     
+    }
+
+  }                                            
+ 
+}
+
+
+	 
+  
+
+
+
+
+
+
diff --git a/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo.C b/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo.C
new file mode 100644
index 0000000000000000000000000000000000000000..ddb74ae6612bb0edc7c08571535f55acd5e2d0dc
--- /dev/null
+++ b/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo.C
@@ -0,0 +1,98 @@
+//Script to add necessary drift time histograms/plane from original root file to new root file
+
+
+#define NPLANES 12
+
+void get_pdc_time_histo()
+{
+
+  //Read Run Number from txt file
+  int run_NUM;
+  TString f0 = "input_RUN.txt";
+  ifstream infile(f0);
+  infile >> run_NUM;
+
+  //Create RUN Directories if they dont exist
+  char *dir0 = Form("mkdir ../root_files/run%d", run_NUM);
+  char *dir1 = Form("mkdir ../data_files/run%d", run_NUM);
+
+  if (system(dir0 || dir1) != 0) {
+    system(dir0);
+    system(dir1);
+  }
+
+  //open file
+  TFile *f = new TFile(Form("../../../ROOTfiles/pdc_replay_%d.root", run_NUM), "READ");
+
+  //create new file
+  TFile *g = new TFile(Form("../root_files/run%d/shms_dc_time_%d.root", run_NUM, run_NUM), "RECREATE"); // create new file to store histo
+
+  f->cd();
+
+  //Get the tree
+  TTree *tree = (TTree*)f->Get("T");
+  TString SPECTROMETER="P";
+  TString DETECTOR="dc";
+  TString plane_names[NPLANES]={"1u1", "1u2", "1x1", "1x2", "1v1", "1v2", "2v2", "2v1", "2x2", "2x1", "2u2", "2u1"};
+  
+  //Declare Variables to Loop Over
+  Int_t Ndata[NPLANES];
+  Double_t pdc_time[NPLANES][1000];
+    
+  //Declare Histogram array to store AVG drift times per plane
+  TH1F* h[NPLANES];
+	
+  g->cd();
+	
+  //Loop over each plane
+  for(Int_t ip=0; ip<NPLANES; ip++){
+    TString base_name = SPECTROMETER+"."+DETECTOR+"."+plane_names[ip];
+    TString ndata_name = "Ndata."+base_name+".time";
+    TString drift_time = base_name+".time";
+  
+    TString drift_time_histo = "pdc"+plane_names[ip]+"_time"; 
+    TString title = "pdc"+plane_names[ip]+"_drifttime";
+     
+    //Set Branch Address
+    tree->SetBranchAddress(drift_time, &pdc_time[ip][0]);   
+    tree->SetBranchAddress(ndata_name, &Ndata[ip]);  /* Ndata represents number of triggers vs number of hits that each trigger produced.
+							A hit is refer to as when a trigger(traversing particle), ionizes the WC gas and ionized
+							electrons reach the rearest sense wire, producing a detectable signal in the O'scope */
+  
+    //Create Histograms
+    h[ip] = new TH1F(drift_time_histo, title, 200, -50, 350);  //set time to 400 ns/200 bins = 2ns/bin
+  }
+ 
+
+ 
+  //Declare number of entries in the tree
+  Long64_t nentries = tree->GetEntries(); //number of triggers (particles that passed through all 4 hodo planes)
+ 
+  //Loop over all entries
+  for(Long64_t i=0; i<nentries; i++)
+    {
+      tree->GetEntry(i);
+    
+    
+      //Loop over number of hits for each trigger in each DC plane 
+      for(ip=0; ip<NPLANES; ip++){
+       
+    
+	for(Int_t j=0; j<Ndata[ip]; j++){
+	
+	  h[ip]->Fill(pdc_time[ip][j]); 
+	}
+       
+      }
+
+    }
+
+
+
+		
+  //Write histograms to file
+  g->Write();
+
+
+
+}
diff --git a/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo_tzero_corrected.C b/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo_tzero_corrected.C
new file mode 100644
index 0000000000000000000000000000000000000000..581f7972467d9e4f7ed650de5048c3d583be80ed
--- /dev/null
+++ b/CALIBRATION/shms_dc_calib/scripts/get_pdc_time_histo_tzero_corrected.C
@@ -0,0 +1,107 @@
+//Script to add t0 correction to SHMS DC drift times
+
+#define NPLANES 12
+
+void get_pdc_time_histo_tzero_corrected()
+{
+
+	  
+  //read run number from input file
+  int run_NUM;
+  TString f0 = "input_RUN.txt";
+  ifstream infile(f0);
+  infile >> run_NUM;   
+
+  TString run = Form("run%d", run_NUM);
+
+
+	  //open file
+	  TFile *f = new TFile(Form("../../../ROOTfiles/pdc_replay_%d.root", run_NUM), "READ");
+
+	  //updates file
+	  TFile *g = new TFile(Form("../root_files/run%d/shms_dc_t0_corrected_%d.root", run_NUM, run_NUM), "UPDATE"); // create new file to store histo
+
+      f->cd();
+
+     //Get the tree
+     TTree *tree = (TTree*)f->Get("T");
+
+	TString SPECTROMETER="P";
+	TString DETECTOR="dc";
+	TString plane_names[NPLANES]={"1u1", "1u2", "1x1", "1x2", "1v1", "1v2", "2v2", "2v1", "2x2", "2x1", "2u2", "2u1"};
+
+    //Declare Variables to Loop Over
+    Int_t Ndata[NPLANES];
+    Double_t pdc_time[NPLANES][1000];
+    
+    //Declare Histogram array to store AVG drift times per plane
+    TH1F* h[NPLANES];
+	
+	g->cd();
+	
+	//Loop over each plane
+	for(Int_t ip=0; ip<NPLANES; ip++){
+		TString base_name = SPECTROMETER+"."+DETECTOR+"."+plane_names[ip];
+		TString ndata_name = "Ndata."+base_name+".time";
+		TString drift_time = base_name+".time";
+
+		TString drift_time_histo = "pdc"+plane_names[ip]+"_time: t0_corr"; 
+        TString title = "pdc"+plane_names[ip]+"_drifttime: t0-corrected";
+     
+     //Set Branch Address
+     tree->SetBranchAddress(drift_time, pdc_time[ip]);   
+     tree->SetBranchAddress(ndata_name, &Ndata[ip]);  /* Ndata represents number of triggers vs number of hits that each trigger produced.
+                                                      A hit is refer to as when a trigger(traversing particle), ionizes the WC gas and ionized
+                                                      electrons reach the rearest sense wire, producing a detectable signal in the O'scope */
+	
+     //Create Histograms
+     h[ip] = new TH1F(drift_time_histo, title, 200, -50, 350);  //set time to 400 ns/200 bins = 2ns/bin
+}
+	
+	
+	//open and read tzero data file
+    ifstream ifs;
+    ifs.open("../data_files/" + run + "/tzero.dat");
+    
+	double t_zero_offsets[NPLANES];
+
+     for (ip=0; ip < 12; ip++) {	 
+	 ifs >> t_zero_offsets[ip];  //add tzero offsets to array
+   }
+   
+    //Declare number of entries in the tree
+    Long64_t nentries = tree->GetEntries(); //number of triggers (particles that passed through all 4 hodo planes)
+
+    //Loop over all entries
+    for(Long64_t i=0; i<nentries; i++)
+    {
+	tree->GetEntry(i);
+    
+    
+    //Loop over number of hits for each trigger in each DC plane 
+    for(ip=0; ip<NPLANES; ip++){
+   
+ 
+    
+    for(Int_t j=0; j<Ndata[ip]; j++){
+	
+	h[ip]->Fill(pdc_time[ip][j] - t_zero_offsets[ip]); //add t0 offset correction 
+       }
+      
+      
+
+			
+	
+	}
+
+}
+
+
+
+		
+//Write histograms to file
+g->Write();
+
+
+
+}
diff --git a/CALIBRATION/shms_dc_calib/scripts/get_wire_tzero.C b/CALIBRATION/shms_dc_calib/scripts/get_wire_tzero.C
new file mode 100644
index 0000000000000000000000000000000000000000..1c6974e2e6f620f564165387f005b399331d4f16
--- /dev/null
+++ b/CALIBRATION/shms_dc_calib/scripts/get_wire_tzero.C
@@ -0,0 +1,397 @@
+
+
+/*Script to extract reference time "t0"  for each sense wire in a given HMS Wire Chamber Plane with COSMIC RUNS.  
+20% (MAX BIN CONTENT) is calculated per wire, and the corresponding bin is fitted linearly about +/- 
+a certain number of bins and this fit is extrapolated to y=0(x-axis). The extrapolated value is take to be t0*/
+
+#include <vector>
+#include <TMath>
+
+#define NPLANES 12
+
+void get_wire_tzero()
+{
+  using namespace std;
+
+  int run_NUM;
+  TString f0 = "input_RUN.txt";
+  ifstream infile(f0);
+  infile >> run_NUM;   
+
+  //check if tzero_weighted_avg text file exists (if it does, DELETE IT, otherwise new values will be appended to it, in addition to pre-existing tzero values)
+  std::ifstream stream(Form("../data_files/run%d/tzero_weighted_avg_run%d.txt",run_NUM, run_NUM));
+ if (stream.good())
+  {
+  gSystem->Exec(Form("rm ../data_files/run%d/tzero_weighted_avg_run%d.txt",run_NUM, run_NUM));
+  }
+
+ TString run = Form("run%d", run_NUM);
+
+ //Declare plane names to loop over
+ TString plane_names[NPLANES]={"1u1", "1u2", "1x1", "1x2", "1v1", "1v2", "2v2", "2v1", "2x2", "2x1", "2u2", "2u1"};
+
+ //Declare a root file array to store individual DC cell drift times
+ TString root_file;
+ TFile *f[NPLANES];
+   
+ int total_wires;  //integer to store total sense wires for a plane chosen by the user
+        
+ //Loop over all planes
+ for (int ip = 0; ip < NPLANES; ip++){
+
+   //READ root file
+   root_file = "../root_files/"+run+"/shms_DC_"+plane_names[ip]+Form("_%d.root",run_NUM);
+   f[ip] = new TFile(root_file, "READ");
+
+   //Create a file output file stream object to write t0 values to data file
+   ofstream ofs;
+   TString t_zero_file = "../data_files/" + run + "/hdc_"+plane_names[ip]+Form("tzero_run%d.dat", run_NUM);
+   ofs.open (t_zero_file);
+
+   //Set headers for subsequent columns of data
+   ofs << "#WIRE " << "   "  << "t0" << "   " << "t0_err" << "   " << " entries " << endl;
+
+   //Create root file to store fitted wire drift times histos and "t0 vs. wirenum"
+   TString output_root_file = "../root_files/"+run+"/shmsDC_"+plane_names[ip]+Form("run%d_fitted_histos.root", run_NUM);
+   TFile *g = new TFile(output_root_file,"RECREATE");
+
+   f[ip]->cd();  //change to file containing the wire drift times histos
+ 
+   int total_wires;  //integer to store total sense wires for a plane chosen by the user
+   
+   //Set variables depending on which plane is being studied
+   if(ip == 0 || ip == 1 || ip == 4 || ip == 5 || ip == 6 || ip == 7 || ip == 10 || ip == 11) {
+     TH1F *cell_dt[107]; //declare array of histos to store drift times     
+     total_wires=107; 
+
+     //Declare bin properties for given sense wires in a plane
+
+     int bin_max[107];                    /*Array to store the bin number corresponding to the drift time distribution peak*/
+     int bin_maxContent[107];             /*Array to store the content (# events) corresponding to the bin with maximum content*/
+     double time_max[107];                /*Array to store the x-axis(drift time (ns)) corresponding to bin_max*/
+     double twenty_perc_maxContent[107];  /*Array to store 20% of maximum bin content (peak)*/						     
+     double ref_time[107];               /*Array to store reference times for each sense wire*/
+
+   }
+
+   else if(ip == 2 || ip == 3 || ip == 8 || ip == 9) {
+     TH1F *cell_dt[79];
+     total_wires=79;      
+   
+     int bin_max[79];                                 
+     int bin_maxContent[79];                           
+     double time_max[79];                               
+     double twenty_perc_maxContent[79];                
+     double ref_time[79];          
+
+   }	   
+   
+ 	
+   /*Get wire histos from root file and loop over each 
+     sense wire of a plane in shms Drift Chambers (DC1 or DC2)*/
+ 
+   for (int sensewire=1; sensewire<=total_wires; sensewire++){
+
+     //Get title of histos in root file
+     TString drift_time_histo = Form("wire_%d", sensewire); 
+ 
+     //Get drift time histograms from root file
+     cell_dt[sensewire-1] = (TH1F*)f[ip]->Get(drift_time_histo);
+
+     
+     //Get bin with Maximum Content
+     bin_max[sensewire-1] = cell_dt[sensewire-1]->GetMaximumBin();
+
+     //Get content of bin_max
+     bin_maxContent[sensewire-1] = cell_dt[sensewire-1]->GetBinContent(bin_max[sensewire-1]);
+     
+     //Get time (ns) [x-axis] corresponding to bin_max 
+     time_max[sensewire-1] = cell_dt[sensewire-1]->GetXaxis()->GetBinCenter(bin_max[sensewire-1]);
+     
+     //Calculate 20% of max content
+     twenty_perc_maxContent[sensewire-1] = bin_maxContent[sensewire-1] * 0.20;
+     
+
+   }
+   
+   
+   
+   //****************************************************//
+   //Determine  which bin has around 20% max_BinContent *//
+   //****************************************************//
+   
+   
+   //Declarations
+   int content_bin;      //stores content for each bin
+   int counts;           //a counter used to count the number of bins that have >20% max bin content for a plane 
+   int bin;              //store bin number
+   int j;                //jth bin, used to loop over n bins 
+   
+   //Declare vector arrays 
+   vector<int> content;               //stores bin content
+   vector <int> bin_num;           //stores bin number
+   
+   
+   //Loop over each wire 
+   for(sensewire=1; sensewire<=total_wires; sensewire++) {
+     
+     //Loop over each bin for individual wire drift time histo
+     for(bin=0; bin < bin_max[sensewire-1]; bin++) {
+       
+       content_bin = cell_dt[sensewire-1]->GetBinContent(bin);              //get bin content for all bins in a wire
+       
+       content.push_back(content_bin);                                      //add bin content to array
+       bin_num.push_back(bin);                                              //add bin number to array
+       
+       
+       // check if 2 bin contents have been stored and examine if these contents exceed or not 20% of peak
+       if (content.size() == 2) {
+	 
+	 //initialize counter to count how many bin contents >= 20%
+	 counts = 0;
+	 
+	 // Loop over 2 bin contents stored in array content
+	 for (j=0; j<2; j++){
+	   
+	   if(content[j] > =  twenty_perc_maxContent[sensewire-1]){
+	     counts = counts+1;
+             
+	     if(counts >= 2) { goto stop;}
+	     
+	     
+	   }
+	   
+	   content.clear();
+	   bin_num.clear();
+	   
+	 }
+	 
+       }
+     }
+     
+     //Print the time(ns) and BIN NUM corresponding to 20% of MAX content 
+     //if 2/2 elements exceeds 20% of Max content (for each plane)
+     
+   stop:
+     ref_time[sensewire-1] = cell_dt[sensewire-1] ->GetXaxis() -> GetBinCenter(bin_num[0]); //Get time corresponding ~20% Max BIN CONTENT  
+     
+     //cout << " ******* " << "Wire " << sensewire << " ******* " << endl;
+     //cout << "time (20% of Max BIN): " << ref_time[sensewire-1] << " ns" << endl;
+     //cout << "BIN: " << bin_num[0] << endl;
+     
+     
+     //*********************************************************//
+     //*******Extract the "t0" Using a Fitting Procedure********//
+     //*********************************************************//
+     
+     //Declarations
+     int time_init;           //start fit value 
+     int time_final;          //end fit value
+     int t_zero;
+     int entries;             //entries for each wire
+     
+     double m;                //slope
+     double y_int;            //y-intercept
+     double m_err;
+     double y_int_err;
+     double t_zero_err;
+     
+     //Get time corresponding to bin (fit range) 
+     time_init = cell_dt[sensewire-1] -> GetXaxis() -> GetBinCenter(bin_num[0]-5); //choose bin range over which to fit
+     time_final = cell_dt[sensewire-1] -> GetXaxis() -> GetBinCenter(bin_num[0]+5); 
+     
+     //Create Fit Function
+     TF1* tZero_fit = new TF1("tZero_fit", "[0]*x + [1]", time_init, time_final);
+     
+     //Set Parameter Names and Values
+     tZero_fit->SetParName(0, "slope");
+     tZero_fit->SetParName(1, "y-int");
+     tZero_fit->SetParameter(0, 1.0);
+     tZero_fit->SetParameter(1, 1.0);
+     
+     //Fit Function in specified range
+     cell_dt[sensewire-1]->Fit("tZero_fit", "QR");
+     
+     //Get Parameters and their errors
+     m = tZero_fit->GetParameter(0);
+     y_int = tZero_fit->GetParameter(1);
+     m_err = tZero_fit->GetParError(0);
+     y_int_err = tZero_fit->GetParError(1);
+     
+     //Calculate error on t0 using error propagation method of expanding partial derivatives
+     t_zero = - y_int/m;
+     t_zero_err = sqrt(y_int_err*y_int_err/(m*m) + y_int*y_int*m_err*m_err/(m*m*m*m) );
+     entries = cell_dt[sensewire-1]->GetEntries();  //number of entries (triggers) per wire
+     
+     //Write "t0" values to file
+     ofs << sensewire << "          " << t_zero << "          " << t_zero_err << "          " << entries << endl;
+     
+     //Change to output root file and write fitted histos to file
+     g->cd();
+     cell_dt[sensewire-1]->Write();
+     
+   }
+   
+   // Make Plot of t0 versus Wire Number 
+   
+   TCanvas *t = new TCanvas("t", "", 2000,500);
+   t->SetGrid();
+
+   
+   TGraphErrors *graph = new TGraphErrors(t_zero_file, "%lg %lg %lg");
+   graph->SetName("graph");
+   TString title = "DC"+plane_names[ip]+": t0 versus sensewire";
+   graph->SetTitle(title);
+   graph->SetMarkerStyle(20);
+   graph->SetMarkerColor(1);
+   graph->GetXaxis()->SetLimits(0., total_wires);
+   graph->GetXaxis()->SetTitle("Wire Number");
+   graph->GetXaxis()->CenterTitle();
+   graph->GetYaxis()->SetTitle("t-Zero (ns)");
+   graph->GetYaxis()->CenterTitle();
+   graph->GetYaxis()->SetRangeUser(-50.0, 50.0);
+   graph->Draw("AP");
+   t->Update();
+   t->Write(title);   //write to a root file
+   
+   //close dat file
+   ofs.close();
+   //save plots
+   //TString tzero_plots = "plots/"+run_NUM +"/hdc"+plane_names[ip]+Form("TESTING_tzero_v_wire_%d.eps", run);
+   //t->SaveAs(tzero_plots);
+   
+   
+   //*****************************************************************************************//
+   //        CALCULATE THE "t0s" WEIGHTED AVERAGE FOR WIRE DRIFT TIMES WITH ENTRIES > = 300   //
+   //*****************************************************************************************//
+   
+   
+   //open t0 dat file
+   ifstream ifs;
+   ifs.open (t_zero_file);
+   string line;
+   
+   //open new data file to write updated t0 values
+   TString t_zero_file_corr = "../data_files/" + run + "/hdc_"+plane_names[ip]+Form("tzero_run%d_updated.txt", run_NUM);
+   ofs.open(t_zero_file_corr);
+   ofs << " #Wire " << "     " << " t_zero " << "     " << " t_zero_err " << "     " << " entries " << endl; 
+   
+   //Initialize variables related to weighted avg
+   double sum_NUM;  //numerator of weighted avg
+   double sum_DEN;   //denominator of weighted avg
+   double weighted_AVG;
+   double weighted_AVG_err; 
+  
+   //set them to zero to start sum inside while loop 
+   sum_NUM = 0.0;
+   sum_DEN = 0.0;
+   
+   weighted_AVG;
+   weighted_AVG_err; 
+   
+   //read line bt line the t_zero_file
+   while(getline(ifs, line)) {
+     if(!line.length()|| line[0] == '#')
+       continue;
+     //	sensewire = 0, t_zero = 0.0, t_zero_err = 0.0, entries = 0 ; //set values to zero
+     
+     sscanf(line.c_str(), "%d %d %lf %d", &sensewire, &t_zero, &t_zero_err, &entries); //assign each of the variables above a data in the t_zero_file
+     
+     //Check if entries for each sensewire exceeds a certain number of events
+     
+     if (entries>300 && t_zero < 30) {
+	
+       //Calculate the weighted average of t0s
+       sum_NUM = sum_NUM + t_zero/(t_zero_err*t_zero_err);
+       sum_DEN = sum_DEN + 1.0/(t_zero_err*t_zero_err);      
+       
+       //cout << "sum_NUM : " << sum_NUM << endl;  
+       //cout << "sum_DEN : " << sum_DEN << endl;  
+       
+    
+
+
+       ofs << sensewire << "        " << t_zero << "        " << t_zero_err << "        " << entries << endl;
+
+       
+       
+     }
+     
+   }
+   
+   
+   
+   weighted_AVG = sum_NUM / sum_DEN;
+   weighted_AVG_err = sqrt( 1.0 / sum_DEN );
+   
+   
+   
+   //open new data file to write weighted average of updated t_zero values
+   
+   TString t_zero_AVG = Form("../data_files/run%d/tzero_weighted_avg_run%d.txt", run_NUM, run_NUM);
+   
+   ofstream ofile;
+   ofile.open(t_zero_AVG, std::ofstream::out | std::ofstream::app); //open file in and output and append mode
+   
+   ofile << " #weighted_AVG " << "     " << " DC plane: " <<  plane_names[ip] << endl; 
+   ofile << weighted_AVG << endl;
+   
+  
+   
+   
+   
+   ifs.close();
+
+   // Make Plot of t0 versus Wire Number for entries > 300 events
+
+   TCanvas *t1 = new TCanvas("t1", "", 2000,500);
+   t1->SetGrid();
+
+   //TString mygraph = "hdc"+plane_names[ip]+Form("_t_zero_run%d.txt", run);
+   TGraphErrors *graph1 = new TGraphErrors(t_zero_file_corr, "%lg %lg %lg");
+   graph1->SetName("graph1");
+   TString title1 = "hdc"+plane_names[ip]+": t0 versus sensewire_corrected";
+   graph1->SetTitle(title1);
+   graph1->SetMarkerStyle(20);
+   graph1->SetMarkerColor(1);
+   //graph1->GetXaxis()->SetLimits(0., total_wires);
+   graph1->GetXaxis()->SetTitle("Wire Number");
+   graph1->GetXaxis()->CenterTitle();
+   graph1->GetYaxis()->SetTitle("t-Zero (ns)");
+   graph1->GetYaxis()->CenterTitle();
+   graph1->GetYaxis()->SetRangeUser(-50.0, 50.0);
+   graph1->Draw("AP");
+   t1->Update();
+
+   // Draw TLine
+   TLine *wght_avg = new TLine(t1->GetUxmin(), weighted_AVG, t1->GetUxmax(), weighted_AVG);
+   wght_avg->SetLineColor(kRed);
+   wght_avg->SetLineWidth(2);
+   wght_avg->SetLineStyle(2);
+   wght_avg->Draw();
+   
+   //Add text to canvas
+   TLatex* ltx1 =  new TLatex();
+   ltx1->DrawLatex(t1->GetUxmax()*0.75,40, Form("Weighted Average = %lf #pm %lf ns", weighted_AVG, weighted_AVG_err) );
+   
+   t1->Write(title1);   //write canvas to a root file
+   
+   ofs.close();  //close data file
+
+   
+
+
+
+
+
+
+
+
+ }
+ 
+ 
+
+
+
+
+}
diff --git a/CALIBRATION/shms_dc_calib/scripts/input_RUN.txt b/CALIBRATION/shms_dc_calib/scripts/input_RUN.txt
new file mode 100644
index 0000000000000000000000000000000000000000..74fa38c97542c71795d3de22b67a8e6d3d9d5032
--- /dev/null
+++ b/CALIBRATION/shms_dc_calib/scripts/input_RUN.txt
@@ -0,0 +1 @@
+407
diff --git a/CALIBRATION/shms_dc_calib/scripts/update_pdcparam.C b/CALIBRATION/shms_dc_calib/scripts/update_pdcparam.C
new file mode 100644
index 0000000000000000000000000000000000000000..bc10993b4a83700935ff4b582845f157ae759d37
--- /dev/null
+++ b/CALIBRATION/shms_dc_calib/scripts/update_pdcparam.C
@@ -0,0 +1,111 @@
+//This scirpt will produce an updated version of hdc.param file, with
+//the necessary t-zero corrections
+#define time_shift 1280.0
+
+void update_pdcparam()
+{
+	  
+  //read run number from input file
+  int run_NUM;
+  TString f0 = "input_RUN.txt";
+  ifstream infile(f0);
+  infile >> run_NUM;   
+
+  TString run = Form("run%d", run_NUM);
+
+    int lin_NUM = 0;
+	string t_zero[12];
+	double tzero[12];
+	string line;
+   //open t_zero file
+   ifstream ifs;
+   ifs.open("../data_files/"+ run +"/tzero_weighted_avg_" + run + ".txt");
+   
+
+while (getline(ifs, line))
+  {
+    
+    istringstream ss(line);
+    char id;
+    
+    if ( ss >> t_zero)
+      {
+		
+	if (id != '#') //skip comments   
+	  {
+	    //count lines  
+	    lin_NUM = lin_NUM + 1;
+	    cout << lin_NUM << endl;    
+	       t_zero[lin_NUM-1] = line;
+	       tzero[lin_NUM-1] = atof(t_zero[lin_NUM-1].c_str()); // convert string to double
+	    cout << tzero[lin_NUM-1] << endl;
+	  }       
+	
+      }     
+    
+  }
+ifs.close();
+
+//Update pdc.param parameter file 
+TString pdc_param = "../../../PARAM/SHMS/DC/pdc_tracking_new.param";
+ofstream ofs(pdc_param);
+
+// ofs << ";---------------------------------------------------------------------" << endl;
+// ofs <<"; SHMS_TRACKING"<< endl;
+// ofs <<"; CTP parameter file containing all tracking parameters for the SHMS "<< endl;
+// ofs <<";----------------------------------------------------------------------"<< endl;
+// ofs <<"; sigma of wire chamber resolution for each plane "<< endl;
+// ofs <<" pdc_sigma = 0.020 "<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"             0.020"<< endl;
+// ofs <<"  pdc_tdc_min_win = -25000,-25000,-25000,-25000,-25000,-25000 "<< endl;
+// ofs <<"  		    -25000,-25000,-25000,-25000,-25000,-25000 "<< endl;
+// ofs <<"  pdc_tdc_max_win = 25000,25000,25000,25000,25000,25000 "<< endl;
+// ofs <<"                    25000,25000,25000,25000,25000,25000 "<< endl;
+// ofs <<"; hms drift chamber tdc's time per channel "<< endl;
+// ofs <<"        pdc_tdc_time_per_channel = -0.10 "<< endl;
+// ofs <<"; hms zero time for drift chambers	!DECREASING this number moves the hdtime plots to LOWER time. "<< endl;
+// ofs <<"pdc_plane_time_zero =  ";
+
+
+//*****************************************************************
+//output all t_0 corrected values to pdc.param    
+for (int i=0; i<12; i++) { 
+{
+if (i < = 5){
+ofs  <<  time_shift - tzero[i]   << ","; 
+}
+if (i ==6) {ofs << "\n" << time_shift - tzero[6]  << ",";}
+else if (i>6 && i <11) {
+ofs << time_shift - tzero[i] << ","; 
+}
+if (i==11){ ofs << time_shift - tzero[i] << endl;}
+}
+}
+//*****************************************************************
+// ofs << "\n";
+// ofs <<"; Dave Abbott's wire velocity correction "<< endl;
+// ofs <<"pdc_wire_velocity = 12.0 "<< endl;
+// ofs <<"pdc_central_time = 7,9,3,4,6,5 "<< endl;
+// ofs << "                   7,5,3,4,6,6" << endl;
+ofs.close();
+
+//create a t_zero data file copy in another directory that will also use these values
+TString tzero_dat = "../data_files/" + run + "/tzero.dat";
+ofstream ofs(tzero_dat);
+
+for (int i=0; i<12; i++) 
+{
+ofs  <<  tzero[i]  << endl; 
+}
+ 
+}
diff --git a/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.C b/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.C
new file mode 100644
index 0000000000000000000000000000000000000000..7d8cb9455fb7e00c9cb96c1236408d20665e900c
--- /dev/null
+++ b/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.C
@@ -0,0 +1,282 @@
+#define wire_drift_times_cxx
+#include "wire_drift_times.h"
+#include <TH2.h>
+#include <TStyle.h>
+#include <TCanvas.h>
+#define NPLANES 12
+
+void wire_drift_times::Loop()
+{
+  //   In a ROOT session, you can do:
+  //      Root > .L wire_drift_times.C
+  //      Root > wire_drift_times t
+  //      Root > t.GetEntry(12); // Fill t data members with entry number 12
+  //      Root > t.Show();       // Show values of entry 12
+  //      Root > t.Show(16);     // Read and show values of entry 16
+  //      Root > t.Loop();       // Loop on all entries
+  //
+
+  //     This is the loop skeleton where:
+  //    jentry is the global entry number in the chain
+  //    ientry is the entry number in the current Tree
+  //  Note that the argument to GetEntry must be:
+  //    jentry for TChain::GetEntry
+  //    ientry for TTree::GetEntry and TBranch::GetEntry
+  //
+  //       To read only selected branches, Insert statements like:
+  // METHOD1:
+  //    fChain->SetBranchStatus("*",0);  // disable all branches
+  //    fChain->SetBranchStatus("branchname",1);  // activate branchname
+  // METHOD2: replace line
+  //    fChain->GetEntry(jentry);       //read all branches
+  //by  b_branchname->GetEntry(ientry); //read only this branch
+  if (fChain == 0) return;
+
+  Long64_t nentries = fChain->GetEntriesFast();
+
+  //Read Run Number from txt file
+  int run_NUM;
+  TString f0 = "input_RUN.txt";
+  ifstream infile(f0);
+  infile >> run_NUM;
+
+  TString run = Form("run%d", run_NUM);
+  //Declare plane names to loop over
+  TString plane_names[NPLANES]={"1u1", "1u2", "1x1", "1x2", "1v1", "1v2", "2v2", "2v1", "2x2", "2x1", "2u2", "2u1"};
+
+  //Declare a root file array to store individual DC cell drift times
+  TString root_file[NPLANES];
+  TFile *g[NPLANES];
+   
+  //integer to store total sense wires for a plane chosen by the user
+  static const Int_t total_wires_x  = 79;  
+  static const Int_t total_wires_uv = 107;
+     
+  Long64_t nbytes = 0, nb = 0;
+   
+  //Loop over all planes
+  for (int ip = 0; ip < NPLANES; ip++){
+
+    //Initialize a root file array to store individual DC cell drift times
+    root_file[ip] = "../root_files/" + run + "/shms_DC_"+plane_names[ip]+Form("_%d.root", run_NUM);
+    g[ip] = new TFile(root_file[ip], "RECREATE");
+    g[ip]->cd();
+
+    /*========================PLANES 1X1,1X2,2X1,2X2=====================================*/
+	
+    //If specific planes are encountered, treat them as follows:
+
+    /*PLANE 1U1, 1V1, 2U1, 2V1*/				
+    //If specific planes are encountered, treat them as follows:
+    if(ip == 0 || ip == 1 || ip == 4 || ip == 5 || ip == 6 || ip == 7 || ip == 10 || ip == 11) {
+
+      TH1F *cell_dt[total_wires_uv];    
+      TH2F *wire_vs_dt = new TH2F("wire_vs_dt", "", 200., -50., 350., 107., 0.,107.);
+    
+      //Initialize wire drift time histograms
+      for (int wirenum=1; wirenum<=total_wires_uv; wirenum++){
+	cell_dt[wirenum-1] = new TH1F(Form("wire_%d", wirenum), "", 200., -50., 350.);
+      }
+	
+      //Loop over all entries (triggers or events)   
+      for (Long64_t jentry=0; jentry<nentries; jentry++) {
+	Long64_t ientry = LoadTree(jentry);
+	if (ientry < 0) break;
+	nb = fChain->GetEntry(jentry);   nbytes += nb;
+	// if (Cut(ientry) < 0) continue;
+ 
+	if (ip == 0) {
+	  for (int i=0; i< Ndata_P_dc_1u1_wirenum; i++){
+	    wirenum = int(P_dc_1u1_wirenum[i]);
+	    //cout << " wire num: " << P_dc_1u1_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_1u1_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_1u1_time[i]);
+	    wire_vs_dt->Fill(P_dc_1u1_time[i], P_dc_1u1_wirenum[i]);
+
+	  }
+	}
+							
+	if (ip == 1) {
+	  for (int i=0; i< Ndata_P_dc_1u2_wirenum; i++){
+	    wirenum = int(P_dc_1u2_wirenum[i]);
+	    //cout << " wire num: " << P_dc_1u2_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_1u2_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_1u2_time[i]);
+	    wire_vs_dt->Fill(P_dc_1u2_time[i], P_dc_1u2_wirenum[i]);
+
+	  }
+	}						
+			
+	if (ip == 4) {
+	  for (int i=0; i< Ndata_P_dc_1v1_wirenum; i++){
+	    wirenum = int(P_dc_1v1_wirenum[i]);
+	    //cout << " wire num: " << P_dc_1v1_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_1v1_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_1v1_time[i]);
+	    wire_vs_dt->Fill(P_dc_1v1_time[i], P_dc_1v1_wirenum[i]);
+
+	  }
+	}		
+			
+	if (ip == 5) {
+	  for (int i=0; i< Ndata_P_dc_1v2_wirenum; i++){
+	    wirenum = int(P_dc_1v2_wirenum[i]);
+	    //cout << " wire num: " << P_dc_1v2_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_1v2_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_1v2_time[i]);
+	    wire_vs_dt->Fill(P_dc_1v2_time[i], P_dc_1v2_wirenum[i]);
+
+	  }
+	}
+
+	if (ip == 6) {
+	  for (int i=0; i< Ndata_P_dc_2v2_wirenum; i++){
+	    wirenum = int(P_dc_2v2_wirenum[i]);
+	    //cout << " wire num: " << P_dc_2v2_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_2v2_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_2v2_time[i]);
+	    wire_vs_dt->Fill(P_dc_2v2_time[i], P_dc_2v2_wirenum[i]);
+
+	  }
+	}
+
+	if (ip == 7) {
+	  for (int i=0; i< Ndata_P_dc_2v1_wirenum; i++){
+	    wirenum = int(P_dc_2v1_wirenum[i]);
+	    //cout << " wire num: " << P_dc_2v1_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_2v1_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_2v1_time[i]);
+	    wire_vs_dt->Fill(P_dc_2v1_time[i], P_dc_2v1_wirenum[i]);
+
+	  }
+	}
+
+	if (ip == 10) {
+	  for (int i=0; i< Ndata_P_dc_2u2_wirenum; i++){
+	    wirenum = int(P_dc_2u2_wirenum[i]);
+	    //cout << " wire num: " << P_dc_2u2_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_2u2_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_2u2_time[i]);
+	    wire_vs_dt->Fill(P_dc_2u2_time[i], P_dc_2u2_wirenum[i]);
+
+	  }
+	}
+
+	if (ip == 11) {
+	  for (int i=0; i< Ndata_P_dc_2u1_wirenum; i++){
+	    wirenum = int(P_dc_2u1_wirenum[i]);
+	    //cout << " wire num: " << P_dc_2u1_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_2u1_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_2u1_time[i]);
+	    wire_vs_dt->Fill(P_dc_2u1_time[i], P_dc_2u1_wirenum[i]);
+
+	  }
+	}						
+					
+					
+					
+      }
+    }
+	
+    if(ip == 2 || ip == 3 || ip == 8 || ip == 9) {
+
+      TH1F *cell_dt[total_wires_x];    
+      TH2F *wire_vs_dt = new TH2F("wire_vs_dt", "", 200., -50., 350., 79., 0., 79.);
+    
+      //Initialize wire drift time histograms
+      for (int wirenum=1; wirenum<=total_wires_x; wirenum++){
+	cell_dt[wirenum-1] = new TH1F(Form("wire_%d", wirenum), "", 200., -50., 350.);
+      }
+	
+      //Loop over all entries (triggers or events)   
+      for (Long64_t jentry=0; jentry<nentries; jentry++) {
+	Long64_t ientry = LoadTree(jentry);
+	if (ientry < 0) break;
+	nb = fChain->GetEntry(jentry);   nbytes += nb;
+	// if (Cut(ientry) < 0) continue;
+ 
+	if (ip == 2) {
+	  for (int i=0; i< Ndata_P_dc_1x1_wirenum; i++){
+	    wirenum = int(P_dc_1x1_wirenum[i]);
+	    //cout << " wire num: " << P_dc_1x1_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_1x1_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_1x1_time[i]);
+	    wire_vs_dt->Fill(P_dc_1x1_time[i], P_dc_1x1_wirenum[i]);
+
+	  }
+	}
+							
+	if (ip == 3) {
+	  for (int i=0; i< Ndata_P_dc_1x2_wirenum; i++){
+	    wirenum = int(P_dc_1x2_wirenum[i]);
+	    //cout << " wire num: " << P_dc_1x2_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_1x2_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_1x2_time[i]);
+	    wire_vs_dt->Fill(P_dc_1x2_time[i], P_dc_1x2_wirenum[i]);
+
+	  }
+	}						
+			
+	if (ip == 8) {
+	  for (int i=0; i< Ndata_P_dc_2x2_wirenum; i++){
+	    wirenum = int(P_dc_2x2_wirenum[i]);
+	    //cout << " wire num: " << P_dc_2x2_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_2x2_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_2x2_time[i]);
+	    wire_vs_dt->Fill(P_dc_2x2_time[i], P_dc_2x2_wirenum[i]);
+
+	  }
+	}		
+			
+	if (ip == 9) {
+	  for (int i=0; i< Ndata_P_dc_2x1_wirenum; i++){
+	    wirenum = int(P_dc_2x1_wirenum[i]);
+	    //cout << " wire num: " << P_dc_2x1_wirenum[i] << endl;
+	    //cout << "Time: " << P_dc_2x1_time[i] << endl;
+
+	    //Fill the Histograms
+	    cell_dt[wirenum-1]->Fill(P_dc_2x1_time[i]);
+	    wire_vs_dt->Fill(P_dc_2x1_time[i], P_dc_2x1_wirenum[i]);
+
+	  }
+	}						
+					
+					
+					
+      }
+    }
+					
+
+
+    //Write wire drift time histos to file
+    g[ip]->Write();
+    cout << "EVERYTHING OK in plane:" << ip << endl;	
+
+  }
+
+
+  //     cout << "\r          \r" << (float)sensewire / total_wires * 100.0 << "%" << flush; 
+
+}
diff --git a/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.h b/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.h
new file mode 100644
index 0000000000000000000000000000000000000000..862db2e5c98b5c700a6833faa13eb16d5a48b225
--- /dev/null
+++ b/CALIBRATION/shms_dc_calib/scripts/wire_drift_times.h
@@ -0,0 +1,545 @@
+//////////////////////////////////////////////////////////
+// This class has been automatically generated on
+// Tue Mar  7 17:30:40 2017 by ROOT version 5.34/36
+// from TTree T/Hall A Analyzer Output DST
+// found on file: ROOTfiles/pdc_replay_407.root
+//////////////////////////////////////////////////////////
+
+#ifndef wire_drift_times_h
+#define wire_drift_times_h
+
+#include <TROOT.h>
+#include <TChain.h>
+#include <TFile.h>
+
+// Header file for the classes stored in the TTree if any.
+
+// Fixed size dimensions of array or collections stored in the TTree if any.
+
+class wire_drift_times {
+public :
+
+   TTree          *fChain;   //!pointer to the analyzed TTree or TChain
+   Int_t           fCurrent; //!current Tree number in a TChain
+
+   // Declaration of leaf types
+   Int_t           Ndata_P_dc_1u1_dist;
+   Double_t        P_dc_1u1_dist[107];   //[Ndata.P.dc.1u1.dist]
+   Int_t           Ndata_P_dc_1u1_rawtdc;
+   Double_t        P_dc_1u1_rawtdc[107];   //[Ndata.P.dc.1u1.rawtdc]
+   Int_t           Ndata_P_dc_1u1_time;
+   Double_t        P_dc_1u1_time[107];   //[Ndata.P.dc.1u1.time]
+   Int_t           Ndata_P_dc_1u1_wirenum;
+   Double_t        P_dc_1u1_wirenum[107];   //[Ndata.P.dc.1u1.wirenum]
+   Int_t           Ndata_P_dc_1u2_dist;
+   Double_t        P_dc_1u2_dist[107];   //[Ndata.P.dc.1u2.dist]
+   Int_t           Ndata_P_dc_1u2_rawtdc;
+   Double_t        P_dc_1u2_rawtdc[107];   //[Ndata.P.dc.1u2.rawtdc]
+   Int_t           Ndata_P_dc_1u2_time;
+   Double_t        P_dc_1u2_time[107];   //[Ndata.P.dc.1u2.time]
+   Int_t           Ndata_P_dc_1u2_wirenum;
+   Double_t        P_dc_1u2_wirenum[107];   //[Ndata.P.dc.1u2.wirenum]
+   Int_t           Ndata_P_dc_1v1_dist;
+   Double_t        P_dc_1v1_dist[107];   //[Ndata.P.dc.1v1.dist]
+   Int_t           Ndata_P_dc_1v1_rawtdc;
+   Double_t        P_dc_1v1_rawtdc[107];   //[Ndata.P.dc.1v1.rawtdc]
+   Int_t           Ndata_P_dc_1v1_time;
+   Double_t        P_dc_1v1_time[107];   //[Ndata.P.dc.1v1.time]
+   Int_t           Ndata_P_dc_1v1_wirenum;
+   Double_t        P_dc_1v1_wirenum[107];   //[Ndata.P.dc.1v1.wirenum]
+   Int_t           Ndata_P_dc_1v2_dist;
+   Double_t        P_dc_1v2_dist[107];   //[Ndata.P.dc.1v2.dist]
+   Int_t           Ndata_P_dc_1v2_rawtdc;
+   Double_t        P_dc_1v2_rawtdc[107];   //[Ndata.P.dc.1v2.rawtdc]
+   Int_t           Ndata_P_dc_1v2_time;
+   Double_t        P_dc_1v2_time[107];   //[Ndata.P.dc.1v2.time]
+   Int_t           Ndata_P_dc_1v2_wirenum;
+   Double_t        P_dc_1v2_wirenum[107];   //[Ndata.P.dc.1v2.wirenum]
+   Int_t           Ndata_P_dc_1x1_dist;
+   Double_t        P_dc_1x1_dist[80];   //[Ndata.P.dc.1x1.dist]
+   Int_t           Ndata_P_dc_1x1_rawtdc;
+   Double_t        P_dc_1x1_rawtdc[80];   //[Ndata.P.dc.1x1.rawtdc]
+   Int_t           Ndata_P_dc_1x1_time;
+   Double_t        P_dc_1x1_time[80];   //[Ndata.P.dc.1x1.time]
+   Int_t           Ndata_P_dc_1x1_wirenum;
+   Double_t        P_dc_1x1_wirenum[80];   //[Ndata.P.dc.1x1.wirenum]
+   Int_t           Ndata_P_dc_1x2_dist;
+   Double_t        P_dc_1x2_dist[80];   //[Ndata.P.dc.1x2.dist]
+   Int_t           Ndata_P_dc_1x2_rawtdc;
+   Double_t        P_dc_1x2_rawtdc[80];   //[Ndata.P.dc.1x2.rawtdc]
+   Int_t           Ndata_P_dc_1x2_time;
+   Double_t        P_dc_1x2_time[80];   //[Ndata.P.dc.1x2.time]
+   Int_t           Ndata_P_dc_1x2_wirenum;
+   Double_t        P_dc_1x2_wirenum[80];   //[Ndata.P.dc.1x2.wirenum]
+   Int_t           Ndata_P_dc_2u1_dist;
+   Double_t        P_dc_2u1_dist[107];   //[Ndata.P.dc.2u1.dist]
+   Int_t           Ndata_P_dc_2u1_rawtdc;
+   Double_t        P_dc_2u1_rawtdc[107];   //[Ndata.P.dc.2u1.rawtdc]
+   Int_t           Ndata_P_dc_2u1_time;
+   Double_t        P_dc_2u1_time[107];   //[Ndata.P.dc.2u1.time]
+   Int_t           Ndata_P_dc_2u1_wirenum;
+   Double_t        P_dc_2u1_wirenum[107];   //[Ndata.P.dc.2u1.wirenum]
+   Int_t           Ndata_P_dc_2u2_dist;
+   Double_t        P_dc_2u2_dist[107];   //[Ndata.P.dc.2u2.dist]
+   Int_t           Ndata_P_dc_2u2_rawtdc;
+   Double_t        P_dc_2u2_rawtdc[107];   //[Ndata.P.dc.2u2.rawtdc]
+   Int_t           Ndata_P_dc_2u2_time;
+   Double_t        P_dc_2u2_time[107];   //[Ndata.P.dc.2u2.time]
+   Int_t           Ndata_P_dc_2u2_wirenum;
+   Double_t        P_dc_2u2_wirenum[107];   //[Ndata.P.dc.2u2.wirenum]
+   Int_t           Ndata_P_dc_2v1_dist;
+   Double_t        P_dc_2v1_dist[107];   //[Ndata.P.dc.2v1.dist]
+   Int_t           Ndata_P_dc_2v1_rawtdc;
+   Double_t        P_dc_2v1_rawtdc[107];   //[Ndata.P.dc.2v1.rawtdc]
+   Int_t           Ndata_P_dc_2v1_time;
+   Double_t        P_dc_2v1_time[107];   //[Ndata.P.dc.2v1.time]
+   Int_t           Ndata_P_dc_2v1_wirenum;
+   Double_t        P_dc_2v1_wirenum[107];   //[Ndata.P.dc.2v1.wirenum]
+   Int_t           Ndata_P_dc_2v2_dist;
+   Double_t        P_dc_2v2_dist[107];   //[Ndata.P.dc.2v2.dist]
+   Int_t           Ndata_P_dc_2v2_rawtdc;
+   Double_t        P_dc_2v2_rawtdc[107];   //[Ndata.P.dc.2v2.rawtdc]
+   Int_t           Ndata_P_dc_2v2_time;
+   Double_t        P_dc_2v2_time[107];   //[Ndata.P.dc.2v2.time]
+   Int_t           Ndata_P_dc_2v2_wirenum;
+   Double_t        P_dc_2v2_wirenum[107];   //[Ndata.P.dc.2v2.wirenum]
+   Int_t           Ndata_P_dc_2x1_dist;
+   Double_t        P_dc_2x1_dist[80];   //[Ndata.P.dc.2x1.dist]
+   Int_t           Ndata_P_dc_2x1_rawtdc;
+   Double_t        P_dc_2x1_rawtdc[80];   //[Ndata.P.dc.2x1.rawtdc]
+   Int_t           Ndata_P_dc_2x1_time;
+   Double_t        P_dc_2x1_time[80];   //[Ndata.P.dc.2x1.time]
+   Int_t           Ndata_P_dc_2x1_wirenum;
+   Double_t        P_dc_2x1_wirenum[80];   //[Ndata.P.dc.2x1.wirenum]
+   Int_t           Ndata_P_dc_2x2_dist;
+   Double_t        P_dc_2x2_dist[80];   //[Ndata.P.dc.2x2.dist]
+   Int_t           Ndata_P_dc_2x2_rawtdc;
+   Double_t        P_dc_2x2_rawtdc[80];   //[Ndata.P.dc.2x2.rawtdc]
+   Int_t           Ndata_P_dc_2x2_time;
+   Double_t        P_dc_2x2_time[80];   //[Ndata.P.dc.2x2.time]
+   Int_t           Ndata_P_dc_2x2_wirenum;
+   Double_t        P_dc_2x2_wirenum[80];   //[Ndata.P.dc.2x2.wirenum]
+   Int_t           Ndata_P_dc_residual;
+   Double_t        P_dc_residual[12];   //[Ndata.P.dc.residual]
+   Int_t           Ndata_P_dc_x;
+   Double_t        P_dc_x[10];   //[Ndata.P.dc.x]
+   Int_t           Ndata_P_dc_xp;
+   Double_t        P_dc_xp[10];   //[Ndata.P.dc.xp]
+   Int_t           Ndata_P_dc_y;
+   Double_t        P_dc_y[10];   //[Ndata.P.dc.y]
+   Int_t           Ndata_P_dc_yp;
+   Double_t        P_dc_yp[10];   //[Ndata.P.dc.yp]
+   Double_t        P_dc_1u1_nhit;
+   Double_t        P_dc_1u2_nhit;
+   Double_t        P_dc_1v1_nhit;
+   Double_t        P_dc_1v2_nhit;
+   Double_t        P_dc_1x1_nhit;
+   Double_t        P_dc_1x2_nhit;
+   Double_t        P_dc_2u1_nhit;
+   Double_t        P_dc_2u2_nhit;
+   Double_t        P_dc_2v1_nhit;
+   Double_t        P_dc_2v2_nhit;
+   Double_t        P_dc_2x1_nhit;
+   Double_t        P_dc_2x2_nhit;
+   Double_t        P_dc_Ch1_maxhits;
+   Double_t        P_dc_Ch1_nhit;
+   Double_t        P_dc_Ch1_spacepoints;
+   Double_t        P_dc_Ch1_trawhit;
+   Double_t        P_dc_Ch2_maxhits;
+   Double_t        P_dc_Ch2_nhit;
+   Double_t        P_dc_Ch2_spacepoints;
+   Double_t        P_dc_Ch2_trawhit;
+   Double_t        P_dc_nhit;
+   Double_t        P_dc_nsp;
+   Double_t        P_dc_ntrack;
+   Double_t        P_dc_stubtest;
+   Double_t        P_dc_tnhit;
+   Double_t        P_dc_trawhit;
+ //THaEvent        *Event_Branch;
+   ULong64_t       fEvtHdr_fEvtTime;
+   UInt_t          fEvtHdr_fEvtNum;
+   Int_t           fEvtHdr_fEvtType;
+   Int_t           fEvtHdr_fEvtLen;
+   Int_t           fEvtHdr_fHelicity;
+   Int_t           fEvtHdr_fTargetPol;
+   Int_t           fEvtHdr_fRun;
+
+   // List of branches
+   TBranch        *b_Ndata_P_dc_1u1_dist;   //!
+   TBranch        *b_P_dc_1u1_dist;   //!
+   TBranch        *b_Ndata_P_dc_1u1_rawtdc;   //!
+   TBranch        *b_P_dc_1u1_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_1u1_time;   //!
+   TBranch        *b_P_dc_1u1_time;   //!
+   TBranch        *b_Ndata_P_dc_1u1_wirenum;   //!
+   TBranch        *b_P_dc_1u1_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_1u2_dist;   //!
+   TBranch        *b_P_dc_1u2_dist;   //!
+   TBranch        *b_Ndata_P_dc_1u2_rawtdc;   //!
+   TBranch        *b_P_dc_1u2_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_1u2_time;   //!
+   TBranch        *b_P_dc_1u2_time;   //!
+   TBranch        *b_Ndata_P_dc_1u2_wirenum;   //!
+   TBranch        *b_P_dc_1u2_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_1v1_dist;   //!
+   TBranch        *b_P_dc_1v1_dist;   //!
+   TBranch        *b_Ndata_P_dc_1v1_rawtdc;   //!
+   TBranch        *b_P_dc_1v1_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_1v1_time;   //!
+   TBranch        *b_P_dc_1v1_time;   //!
+   TBranch        *b_Ndata_P_dc_1v1_wirenum;   //!
+   TBranch        *b_P_dc_1v1_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_1v2_dist;   //!
+   TBranch        *b_P_dc_1v2_dist;   //!
+   TBranch        *b_Ndata_P_dc_1v2_rawtdc;   //!
+   TBranch        *b_P_dc_1v2_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_1v2_time;   //!
+   TBranch        *b_P_dc_1v2_time;   //!
+   TBranch        *b_Ndata_P_dc_1v2_wirenum;   //!
+   TBranch        *b_P_dc_1v2_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_1x1_dist;   //!
+   TBranch        *b_P_dc_1x1_dist;   //!
+   TBranch        *b_Ndata_P_dc_1x1_rawtdc;   //!
+   TBranch        *b_P_dc_1x1_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_1x1_time;   //!
+   TBranch        *b_P_dc_1x1_time;   //!
+   TBranch        *b_Ndata_P_dc_1x1_wirenum;   //!
+   TBranch        *b_P_dc_1x1_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_1x2_dist;   //!
+   TBranch        *b_P_dc_1x2_dist;   //!
+   TBranch        *b_Ndata_P_dc_1x2_rawtdc;   //!
+   TBranch        *b_P_dc_1x2_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_1x2_time;   //!
+   TBranch        *b_P_dc_1x2_time;   //!
+   TBranch        *b_Ndata_P_dc_1x2_wirenum;   //!
+   TBranch        *b_P_dc_1x2_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_2u1_dist;   //!
+   TBranch        *b_P_dc_2u1_dist;   //!
+   TBranch        *b_Ndata_P_dc_2u1_rawtdc;   //!
+   TBranch        *b_P_dc_2u1_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_2u1_time;   //!
+   TBranch        *b_P_dc_2u1_time;   //!
+   TBranch        *b_Ndata_P_dc_2u1_wirenum;   //!
+   TBranch        *b_P_dc_2u1_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_2u2_dist;   //!
+   TBranch        *b_P_dc_2u2_dist;   //!
+   TBranch        *b_Ndata_P_dc_2u2_rawtdc;   //!
+   TBranch        *b_P_dc_2u2_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_2u2_time;   //!
+   TBranch        *b_P_dc_2u2_time;   //!
+   TBranch        *b_Ndata_P_dc_2u2_wirenum;   //!
+   TBranch        *b_P_dc_2u2_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_2v1_dist;   //!
+   TBranch        *b_P_dc_2v1_dist;   //!
+   TBranch        *b_Ndata_P_dc_2v1_rawtdc;   //!
+   TBranch        *b_P_dc_2v1_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_2v1_time;   //!
+   TBranch        *b_P_dc_2v1_time;   //!
+   TBranch        *b_Ndata_P_dc_2v1_wirenum;   //!
+   TBranch        *b_P_dc_2v1_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_2v2_dist;   //!
+   TBranch        *b_P_dc_2v2_dist;   //!
+   TBranch        *b_Ndata_P_dc_2v2_rawtdc;   //!
+   TBranch        *b_P_dc_2v2_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_2v2_time;   //!
+   TBranch        *b_P_dc_2v2_time;   //!
+   TBranch        *b_Ndata_P_dc_2v2_wirenum;   //!
+   TBranch        *b_P_dc_2v2_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_2x1_dist;   //!
+   TBranch        *b_P_dc_2x1_dist;   //!
+   TBranch        *b_Ndata_P_dc_2x1_rawtdc;   //!
+   TBranch        *b_P_dc_2x1_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_2x1_time;   //!
+   TBranch        *b_P_dc_2x1_time;   //!
+   TBranch        *b_Ndata_P_dc_2x1_wirenum;   //!
+   TBranch        *b_P_dc_2x1_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_2x2_dist;   //!
+   TBranch        *b_P_dc_2x2_dist;   //!
+   TBranch        *b_Ndata_P_dc_2x2_rawtdc;   //!
+   TBranch        *b_P_dc_2x2_rawtdc;   //!
+   TBranch        *b_Ndata_P_dc_2x2_time;   //!
+   TBranch        *b_P_dc_2x2_time;   //!
+   TBranch        *b_Ndata_P_dc_2x2_wirenum;   //!
+   TBranch        *b_P_dc_2x2_wirenum;   //!
+   TBranch        *b_Ndata_P_dc_residual;   //!
+   TBranch        *b_P_dc_residual;   //!
+   TBranch        *b_Ndata_P_dc_x;   //!
+   TBranch        *b_P_dc_x;   //!
+   TBranch        *b_Ndata_P_dc_xp;   //!
+   TBranch        *b_P_dc_xp;   //!
+   TBranch        *b_Ndata_P_dc_y;   //!
+   TBranch        *b_P_dc_y;   //!
+   TBranch        *b_Ndata_P_dc_yp;   //!
+   TBranch        *b_P_dc_yp;   //!
+   TBranch        *b_P_dc_1u1_nhit;   //!
+   TBranch        *b_P_dc_1u2_nhit;   //!
+   TBranch        *b_P_dc_1v1_nhit;   //!
+   TBranch        *b_P_dc_1v2_nhit;   //!
+   TBranch        *b_P_dc_1x1_nhit;   //!
+   TBranch        *b_P_dc_1x2_nhit;   //!
+   TBranch        *b_P_dc_2u1_nhit;   //!
+   TBranch        *b_P_dc_2u2_nhit;   //!
+   TBranch        *b_P_dc_2v1_nhit;   //!
+   TBranch        *b_P_dc_2v2_nhit;   //!
+   TBranch        *b_P_dc_2x1_nhit;   //!
+   TBranch        *b_P_dc_2x2_nhit;   //!
+   TBranch        *b_P_dc_Ch1_maxhits;   //!
+   TBranch        *b_P_dc_Ch1_nhit;   //!
+   TBranch        *b_P_dc_Ch1_spacepoints;   //!
+   TBranch        *b_P_dc_Ch1_trawhit;   //!
+   TBranch        *b_P_dc_Ch2_maxhits;   //!
+   TBranch        *b_P_dc_Ch2_nhit;   //!
+   TBranch        *b_P_dc_Ch2_spacepoints;   //!
+   TBranch        *b_P_dc_Ch2_trawhit;   //!
+   TBranch        *b_P_dc_nhit;   //!
+   TBranch        *b_P_dc_nsp;   //!
+   TBranch        *b_P_dc_ntrack;   //!
+   TBranch        *b_P_dc_stubtest;   //!
+   TBranch        *b_P_dc_tnhit;   //!
+   TBranch        *b_P_dc_trawhit;   //!
+   TBranch        *b_Event_Branch_fEvtHdr_fEvtTime;   //!
+   TBranch        *b_Event_Branch_fEvtHdr_fEvtNum;   //!
+   TBranch        *b_Event_Branch_fEvtHdr_fEvtType;   //!
+   TBranch        *b_Event_Branch_fEvtHdr_fEvtLen;   //!
+   TBranch        *b_Event_Branch_fEvtHdr_fHelicity;   //!
+   TBranch        *b_Event_Branch_fEvtHdr_fTargetPol;   //!
+   TBranch        *b_Event_Branch_fEvtHdr_fRun;   //!
+
+   wire_drift_times(TTree *tree=0);
+   virtual ~wire_drift_times();
+   virtual Int_t    Cut(Long64_t entry);
+   virtual Int_t    GetEntry(Long64_t entry);
+   virtual Long64_t LoadTree(Long64_t entry);
+   virtual void     Init(TTree *tree);
+   virtual void     Loop();
+   virtual Bool_t   Notify();
+   virtual void     Show(Long64_t entry = -1);
+};
+
+#endif
+
+#ifdef wire_drift_times_cxx
+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/pdc_replay_407.root");
+      if (!f || !f->IsOpen()) {
+         f = new TFile("../../../ROOTfiles/pdc_replay_407.root");
+      }
+      f->GetObject("T",tree);
+
+   }
+   Init(tree);
+}
+
+wire_drift_times::~wire_drift_times()
+{
+   if (!fChain) return;
+   delete fChain->GetCurrentFile();
+}
+
+Int_t wire_drift_times::GetEntry(Long64_t entry)
+{
+// Read contents of entry.
+   if (!fChain) return 0;
+   return fChain->GetEntry(entry);
+}
+Long64_t wire_drift_times::LoadTree(Long64_t entry)
+{
+// Set the environment to read one entry
+   if (!fChain) return -5;
+   Long64_t centry = fChain->LoadTree(entry);
+   if (centry < 0) return centry;
+   if (fChain->GetTreeNumber() != fCurrent) {
+      fCurrent = fChain->GetTreeNumber();
+      Notify();
+   }
+   return centry;
+}
+
+void wire_drift_times::Init(TTree *tree)
+{
+   // The Init() function is called when the selector needs to initialize
+   // a new tree or chain. Typically here the branch addresses and branch
+   // pointers of the tree will be set.
+   // It is normally not necessary to make changes to the generated
+   // code, but the routine can be extended by the user if needed.
+   // Init() will be called many times when running on PROOF
+   // (once per file to be processed).
+
+   // Set branch addresses and branch pointers
+   if (!tree) return;
+   fChain = tree;
+   fCurrent = -1;
+   fChain->SetMakeClass(1);
+
+   fChain->SetBranchAddress("Ndata.P.dc.1u1.dist", &Ndata_P_dc_1u1_dist, &b_Ndata_P_dc_1u1_dist);
+   fChain->SetBranchAddress("P.dc.1u1.dist", P_dc_1u1_dist, &b_P_dc_1u1_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.1u1.rawtdc", &Ndata_P_dc_1u1_rawtdc, &b_Ndata_P_dc_1u1_rawtdc);
+   fChain->SetBranchAddress("P.dc.1u1.rawtdc", P_dc_1u1_rawtdc, &b_P_dc_1u1_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.1u1.time", &Ndata_P_dc_1u1_time, &b_Ndata_P_dc_1u1_time);
+   fChain->SetBranchAddress("P.dc.1u1.time", P_dc_1u1_time, &b_P_dc_1u1_time);
+   fChain->SetBranchAddress("Ndata.P.dc.1u1.wirenum", &Ndata_P_dc_1u1_wirenum, &b_Ndata_P_dc_1u1_wirenum);
+   fChain->SetBranchAddress("P.dc.1u1.wirenum", P_dc_1u1_wirenum, &b_P_dc_1u1_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.1u2.dist", &Ndata_P_dc_1u2_dist, &b_Ndata_P_dc_1u2_dist);
+   fChain->SetBranchAddress("P.dc.1u2.dist", P_dc_1u2_dist, &b_P_dc_1u2_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.1u2.rawtdc", &Ndata_P_dc_1u2_rawtdc, &b_Ndata_P_dc_1u2_rawtdc);
+   fChain->SetBranchAddress("P.dc.1u2.rawtdc", P_dc_1u2_rawtdc, &b_P_dc_1u2_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.1u2.time", &Ndata_P_dc_1u2_time, &b_Ndata_P_dc_1u2_time);
+   fChain->SetBranchAddress("P.dc.1u2.time", P_dc_1u2_time, &b_P_dc_1u2_time);
+   fChain->SetBranchAddress("Ndata.P.dc.1u2.wirenum", &Ndata_P_dc_1u2_wirenum, &b_Ndata_P_dc_1u2_wirenum);
+   fChain->SetBranchAddress("P.dc.1u2.wirenum", P_dc_1u2_wirenum, &b_P_dc_1u2_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.1v1.dist", &Ndata_P_dc_1v1_dist, &b_Ndata_P_dc_1v1_dist);
+   fChain->SetBranchAddress("P.dc.1v1.dist", P_dc_1v1_dist, &b_P_dc_1v1_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.1v1.rawtdc", &Ndata_P_dc_1v1_rawtdc, &b_Ndata_P_dc_1v1_rawtdc);
+   fChain->SetBranchAddress("P.dc.1v1.rawtdc", P_dc_1v1_rawtdc, &b_P_dc_1v1_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.1v1.time", &Ndata_P_dc_1v1_time, &b_Ndata_P_dc_1v1_time);
+   fChain->SetBranchAddress("P.dc.1v1.time", P_dc_1v1_time, &b_P_dc_1v1_time);
+   fChain->SetBranchAddress("Ndata.P.dc.1v1.wirenum", &Ndata_P_dc_1v1_wirenum, &b_Ndata_P_dc_1v1_wirenum);
+   fChain->SetBranchAddress("P.dc.1v1.wirenum", P_dc_1v1_wirenum, &b_P_dc_1v1_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.1v2.dist", &Ndata_P_dc_1v2_dist, &b_Ndata_P_dc_1v2_dist);
+   fChain->SetBranchAddress("P.dc.1v2.dist", P_dc_1v2_dist, &b_P_dc_1v2_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.1v2.rawtdc", &Ndata_P_dc_1v2_rawtdc, &b_Ndata_P_dc_1v2_rawtdc);
+   fChain->SetBranchAddress("P.dc.1v2.rawtdc", P_dc_1v2_rawtdc, &b_P_dc_1v2_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.1v2.time", &Ndata_P_dc_1v2_time, &b_Ndata_P_dc_1v2_time);
+   fChain->SetBranchAddress("P.dc.1v2.time", P_dc_1v2_time, &b_P_dc_1v2_time);
+   fChain->SetBranchAddress("Ndata.P.dc.1v2.wirenum", &Ndata_P_dc_1v2_wirenum, &b_Ndata_P_dc_1v2_wirenum);
+   fChain->SetBranchAddress("P.dc.1v2.wirenum", P_dc_1v2_wirenum, &b_P_dc_1v2_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.1x1.dist", &Ndata_P_dc_1x1_dist, &b_Ndata_P_dc_1x1_dist);
+   fChain->SetBranchAddress("P.dc.1x1.dist", P_dc_1x1_dist, &b_P_dc_1x1_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.1x1.rawtdc", &Ndata_P_dc_1x1_rawtdc, &b_Ndata_P_dc_1x1_rawtdc);
+   fChain->SetBranchAddress("P.dc.1x1.rawtdc", P_dc_1x1_rawtdc, &b_P_dc_1x1_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.1x1.time", &Ndata_P_dc_1x1_time, &b_Ndata_P_dc_1x1_time);
+   fChain->SetBranchAddress("P.dc.1x1.time", P_dc_1x1_time, &b_P_dc_1x1_time);
+   fChain->SetBranchAddress("Ndata.P.dc.1x1.wirenum", &Ndata_P_dc_1x1_wirenum, &b_Ndata_P_dc_1x1_wirenum);
+   fChain->SetBranchAddress("P.dc.1x1.wirenum", P_dc_1x1_wirenum, &b_P_dc_1x1_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.1x2.dist", &Ndata_P_dc_1x2_dist, &b_Ndata_P_dc_1x2_dist);
+   fChain->SetBranchAddress("P.dc.1x2.dist", P_dc_1x2_dist, &b_P_dc_1x2_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.1x2.rawtdc", &Ndata_P_dc_1x2_rawtdc, &b_Ndata_P_dc_1x2_rawtdc);
+   fChain->SetBranchAddress("P.dc.1x2.rawtdc", P_dc_1x2_rawtdc, &b_P_dc_1x2_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.1x2.time", &Ndata_P_dc_1x2_time, &b_Ndata_P_dc_1x2_time);
+   fChain->SetBranchAddress("P.dc.1x2.time", P_dc_1x2_time, &b_P_dc_1x2_time);
+   fChain->SetBranchAddress("Ndata.P.dc.1x2.wirenum", &Ndata_P_dc_1x2_wirenum, &b_Ndata_P_dc_1x2_wirenum);
+   fChain->SetBranchAddress("P.dc.1x2.wirenum", P_dc_1x2_wirenum, &b_P_dc_1x2_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.2u1.dist", &Ndata_P_dc_2u1_dist, &b_Ndata_P_dc_2u1_dist);
+   fChain->SetBranchAddress("P.dc.2u1.dist", P_dc_2u1_dist, &b_P_dc_2u1_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.2u1.rawtdc", &Ndata_P_dc_2u1_rawtdc, &b_Ndata_P_dc_2u1_rawtdc);
+   fChain->SetBranchAddress("P.dc.2u1.rawtdc", P_dc_2u1_rawtdc, &b_P_dc_2u1_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.2u1.time", &Ndata_P_dc_2u1_time, &b_Ndata_P_dc_2u1_time);
+   fChain->SetBranchAddress("P.dc.2u1.time", P_dc_2u1_time, &b_P_dc_2u1_time);
+   fChain->SetBranchAddress("Ndata.P.dc.2u1.wirenum", &Ndata_P_dc_2u1_wirenum, &b_Ndata_P_dc_2u1_wirenum);
+   fChain->SetBranchAddress("P.dc.2u1.wirenum", P_dc_2u1_wirenum, &b_P_dc_2u1_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.2u2.dist", &Ndata_P_dc_2u2_dist, &b_Ndata_P_dc_2u2_dist);
+   fChain->SetBranchAddress("P.dc.2u2.dist", P_dc_2u2_dist, &b_P_dc_2u2_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.2u2.rawtdc", &Ndata_P_dc_2u2_rawtdc, &b_Ndata_P_dc_2u2_rawtdc);
+   fChain->SetBranchAddress("P.dc.2u2.rawtdc", P_dc_2u2_rawtdc, &b_P_dc_2u2_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.2u2.time", &Ndata_P_dc_2u2_time, &b_Ndata_P_dc_2u2_time);
+   fChain->SetBranchAddress("P.dc.2u2.time", P_dc_2u2_time, &b_P_dc_2u2_time);
+   fChain->SetBranchAddress("Ndata.P.dc.2u2.wirenum", &Ndata_P_dc_2u2_wirenum, &b_Ndata_P_dc_2u2_wirenum);
+   fChain->SetBranchAddress("P.dc.2u2.wirenum", P_dc_2u2_wirenum, &b_P_dc_2u2_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.2v1.dist", &Ndata_P_dc_2v1_dist, &b_Ndata_P_dc_2v1_dist);
+   fChain->SetBranchAddress("P.dc.2v1.dist", P_dc_2v1_dist, &b_P_dc_2v1_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.2v1.rawtdc", &Ndata_P_dc_2v1_rawtdc, &b_Ndata_P_dc_2v1_rawtdc);
+   fChain->SetBranchAddress("P.dc.2v1.rawtdc", P_dc_2v1_rawtdc, &b_P_dc_2v1_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.2v1.time", &Ndata_P_dc_2v1_time, &b_Ndata_P_dc_2v1_time);
+   fChain->SetBranchAddress("P.dc.2v1.time", P_dc_2v1_time, &b_P_dc_2v1_time);
+   fChain->SetBranchAddress("Ndata.P.dc.2v1.wirenum", &Ndata_P_dc_2v1_wirenum, &b_Ndata_P_dc_2v1_wirenum);
+   fChain->SetBranchAddress("P.dc.2v1.wirenum", P_dc_2v1_wirenum, &b_P_dc_2v1_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.2v2.dist", &Ndata_P_dc_2v2_dist, &b_Ndata_P_dc_2v2_dist);
+   fChain->SetBranchAddress("P.dc.2v2.dist", P_dc_2v2_dist, &b_P_dc_2v2_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.2v2.rawtdc", &Ndata_P_dc_2v2_rawtdc, &b_Ndata_P_dc_2v2_rawtdc);
+   fChain->SetBranchAddress("P.dc.2v2.rawtdc", P_dc_2v2_rawtdc, &b_P_dc_2v2_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.2v2.time", &Ndata_P_dc_2v2_time, &b_Ndata_P_dc_2v2_time);
+   fChain->SetBranchAddress("P.dc.2v2.time", P_dc_2v2_time, &b_P_dc_2v2_time);
+   fChain->SetBranchAddress("Ndata.P.dc.2v2.wirenum", &Ndata_P_dc_2v2_wirenum, &b_Ndata_P_dc_2v2_wirenum);
+   fChain->SetBranchAddress("P.dc.2v2.wirenum", P_dc_2v2_wirenum, &b_P_dc_2v2_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.2x1.dist", &Ndata_P_dc_2x1_dist, &b_Ndata_P_dc_2x1_dist);
+   fChain->SetBranchAddress("P.dc.2x1.dist", P_dc_2x1_dist, &b_P_dc_2x1_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.2x1.rawtdc", &Ndata_P_dc_2x1_rawtdc, &b_Ndata_P_dc_2x1_rawtdc);
+   fChain->SetBranchAddress("P.dc.2x1.rawtdc", P_dc_2x1_rawtdc, &b_P_dc_2x1_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.2x1.time", &Ndata_P_dc_2x1_time, &b_Ndata_P_dc_2x1_time);
+   fChain->SetBranchAddress("P.dc.2x1.time", P_dc_2x1_time, &b_P_dc_2x1_time);
+   fChain->SetBranchAddress("Ndata.P.dc.2x1.wirenum", &Ndata_P_dc_2x1_wirenum, &b_Ndata_P_dc_2x1_wirenum);
+   fChain->SetBranchAddress("P.dc.2x1.wirenum", P_dc_2x1_wirenum, &b_P_dc_2x1_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.2x2.dist", &Ndata_P_dc_2x2_dist, &b_Ndata_P_dc_2x2_dist);
+   fChain->SetBranchAddress("P.dc.2x2.dist", P_dc_2x2_dist, &b_P_dc_2x2_dist);
+   fChain->SetBranchAddress("Ndata.P.dc.2x2.rawtdc", &Ndata_P_dc_2x2_rawtdc, &b_Ndata_P_dc_2x2_rawtdc);
+   fChain->SetBranchAddress("P.dc.2x2.rawtdc", P_dc_2x2_rawtdc, &b_P_dc_2x2_rawtdc);
+   fChain->SetBranchAddress("Ndata.P.dc.2x2.time", &Ndata_P_dc_2x2_time, &b_Ndata_P_dc_2x2_time);
+   fChain->SetBranchAddress("P.dc.2x2.time", P_dc_2x2_time, &b_P_dc_2x2_time);
+   fChain->SetBranchAddress("Ndata.P.dc.2x2.wirenum", &Ndata_P_dc_2x2_wirenum, &b_Ndata_P_dc_2x2_wirenum);
+   fChain->SetBranchAddress("P.dc.2x2.wirenum", P_dc_2x2_wirenum, &b_P_dc_2x2_wirenum);
+   fChain->SetBranchAddress("Ndata.P.dc.residual", &Ndata_P_dc_residual, &b_Ndata_P_dc_residual);
+   fChain->SetBranchAddress("P.dc.residual", P_dc_residual, &b_P_dc_residual);
+   fChain->SetBranchAddress("Ndata.P.dc.x", &Ndata_P_dc_x, &b_Ndata_P_dc_x);
+   fChain->SetBranchAddress("P.dc.x", P_dc_x, &b_P_dc_x);
+   fChain->SetBranchAddress("Ndata.P.dc.xp", &Ndata_P_dc_xp, &b_Ndata_P_dc_xp);
+   fChain->SetBranchAddress("P.dc.xp", P_dc_xp, &b_P_dc_xp);
+   fChain->SetBranchAddress("Ndata.P.dc.y", &Ndata_P_dc_y, &b_Ndata_P_dc_y);
+   fChain->SetBranchAddress("P.dc.y", P_dc_y, &b_P_dc_y);
+   fChain->SetBranchAddress("Ndata.P.dc.yp", &Ndata_P_dc_yp, &b_Ndata_P_dc_yp);
+   fChain->SetBranchAddress("P.dc.yp", P_dc_yp, &b_P_dc_yp);
+   fChain->SetBranchAddress("P.dc.1u1.nhit", &P_dc_1u1_nhit, &b_P_dc_1u1_nhit);
+   fChain->SetBranchAddress("P.dc.1u2.nhit", &P_dc_1u2_nhit, &b_P_dc_1u2_nhit);
+   fChain->SetBranchAddress("P.dc.1v1.nhit", &P_dc_1v1_nhit, &b_P_dc_1v1_nhit);
+   fChain->SetBranchAddress("P.dc.1v2.nhit", &P_dc_1v2_nhit, &b_P_dc_1v2_nhit);
+   fChain->SetBranchAddress("P.dc.1x1.nhit", &P_dc_1x1_nhit, &b_P_dc_1x1_nhit);
+   fChain->SetBranchAddress("P.dc.1x2.nhit", &P_dc_1x2_nhit, &b_P_dc_1x2_nhit);
+   fChain->SetBranchAddress("P.dc.2u1.nhit", &P_dc_2u1_nhit, &b_P_dc_2u1_nhit);
+   fChain->SetBranchAddress("P.dc.2u2.nhit", &P_dc_2u2_nhit, &b_P_dc_2u2_nhit);
+   fChain->SetBranchAddress("P.dc.2v1.nhit", &P_dc_2v1_nhit, &b_P_dc_2v1_nhit);
+   fChain->SetBranchAddress("P.dc.2v2.nhit", &P_dc_2v2_nhit, &b_P_dc_2v2_nhit);
+   fChain->SetBranchAddress("P.dc.2x1.nhit", &P_dc_2x1_nhit, &b_P_dc_2x1_nhit);
+   fChain->SetBranchAddress("P.dc.2x2.nhit", &P_dc_2x2_nhit, &b_P_dc_2x2_nhit);
+   fChain->SetBranchAddress("P.dc.Ch1.maxhits", &P_dc_Ch1_maxhits, &b_P_dc_Ch1_maxhits);
+   fChain->SetBranchAddress("P.dc.Ch1.nhit", &P_dc_Ch1_nhit, &b_P_dc_Ch1_nhit);
+   fChain->SetBranchAddress("P.dc.Ch1.spacepoints", &P_dc_Ch1_spacepoints, &b_P_dc_Ch1_spacepoints);
+   fChain->SetBranchAddress("P.dc.Ch1.trawhit", &P_dc_Ch1_trawhit, &b_P_dc_Ch1_trawhit);
+   fChain->SetBranchAddress("P.dc.Ch2.maxhits", &P_dc_Ch2_maxhits, &b_P_dc_Ch2_maxhits);
+   fChain->SetBranchAddress("P.dc.Ch2.nhit", &P_dc_Ch2_nhit, &b_P_dc_Ch2_nhit);
+   fChain->SetBranchAddress("P.dc.Ch2.spacepoints", &P_dc_Ch2_spacepoints, &b_P_dc_Ch2_spacepoints);
+   fChain->SetBranchAddress("P.dc.Ch2.trawhit", &P_dc_Ch2_trawhit, &b_P_dc_Ch2_trawhit);
+   fChain->SetBranchAddress("P.dc.nhit", &P_dc_nhit, &b_P_dc_nhit);
+   fChain->SetBranchAddress("P.dc.nsp", &P_dc_nsp, &b_P_dc_nsp);
+   fChain->SetBranchAddress("P.dc.ntrack", &P_dc_ntrack, &b_P_dc_ntrack);
+   fChain->SetBranchAddress("P.dc.stubtest", &P_dc_stubtest, &b_P_dc_stubtest);
+   fChain->SetBranchAddress("P.dc.tnhit", &P_dc_tnhit, &b_P_dc_tnhit);
+   fChain->SetBranchAddress("P.dc.trawhit", &P_dc_trawhit, &b_P_dc_trawhit);
+   fChain->SetBranchAddress("fEvtHdr.fEvtTime", &fEvtHdr_fEvtTime, &b_Event_Branch_fEvtHdr_fEvtTime);
+   fChain->SetBranchAddress("fEvtHdr.fEvtNum", &fEvtHdr_fEvtNum, &b_Event_Branch_fEvtHdr_fEvtNum);
+   fChain->SetBranchAddress("fEvtHdr.fEvtType", &fEvtHdr_fEvtType, &b_Event_Branch_fEvtHdr_fEvtType);
+   fChain->SetBranchAddress("fEvtHdr.fEvtLen", &fEvtHdr_fEvtLen, &b_Event_Branch_fEvtHdr_fEvtLen);
+   fChain->SetBranchAddress("fEvtHdr.fHelicity", &fEvtHdr_fHelicity, &b_Event_Branch_fEvtHdr_fHelicity);
+   fChain->SetBranchAddress("fEvtHdr.fTargetPol", &fEvtHdr_fTargetPol, &b_Event_Branch_fEvtHdr_fTargetPol);
+   fChain->SetBranchAddress("fEvtHdr.fRun", &fEvtHdr_fRun, &b_Event_Branch_fEvtHdr_fRun);
+   Notify();
+}
+
+Bool_t wire_drift_times::Notify()
+{
+   // The Notify() function is called when a new file is opened. This
+   // can be either for a new TTree in a TChain or when when a new TTree
+   // is started when using PROOF. It is normally not necessary to make changes
+   // to the generated code, but the routine can be extended by the
+   // user if needed. The return value is currently not used.
+
+   return kTRUE;
+}
+
+void wire_drift_times::Show(Long64_t entry)
+{
+// Print contents of entry.
+// If entry is not specified, print current entry
+   if (!fChain) return;
+   fChain->Show(entry);
+}
+Int_t wire_drift_times::Cut(Long64_t entry)
+{
+// This function may be called from Loop.
+// returns  1 if entry is accepted.
+// returns -1 otherwise.
+   return 1;
+}
+#endif // #ifdef wire_drift_times_cxx
diff --git a/PARAM/SHMS/DC/pdc_tracking.param b/PARAM/SHMS/DC/pdc_tracking.param
index da0c0e1eb36f19a48b7c1bc0f66a5233a27c350c..88f5a87ee52fed1930bc4bba4b8965a9235d279f 100644
--- a/PARAM/SHMS/DC/pdc_tracking.param
+++ b/PARAM/SHMS/DC/pdc_tracking.param
@@ -14,8 +14,11 @@ pdc_tdc_max_win = 55000, 55000, 55000, 55000, 55000, 55000  ; TODO - wide limits
 pdc_tdc_time_per_channel = -0.10
 
 ; Zero time correction for each plane in ns that is added to TDC time.
-pdc_plane_time_zero = 1280.0, 1280.0, 1280.0, 1280.0, 1280.0, 1280.0  ; TODO - fine calibration
-                      1280.0, 1280.0, 1280.0, 1280.0, 1280.0, 1280.0
+pdc_plane_time_zero = 1253.89,1252.55,1255.96,1256.28,1256.23,1255.7
+		      1256.94,1256.95,1258.05,1257.86,1257.78,1256.91
+
+;pdc_plane_time_zero = ;1280.0, 1280.0, 1280.0, 1280.0, 1280.0, 1280.0  ; TODO - fine calibration
+                      ;1280.0, 1280.0, 1280.0, 1280.0, 1280.0, 1280.0
 
 ; For wire velocity corrections.
 pdc_wire_velocity = 13.0  ; TODO
diff --git a/PARAM/SHMS/DC/pdriftmap.param b/PARAM/SHMS/DC/pdriftmap.param
index 51186d60246d006ac27035f66b491bee83c8df62..244d58f3ec266be153057a32d1a9277e3f08c013 100644
--- a/PARAM/SHMS/DC/pdriftmap.param
+++ b/PARAM/SHMS/DC/pdriftmap.param
@@ -1,191 +1,175 @@
-; Contains lookup tables for drift time.
-
-; Number of bins in table.
+; Lookup Table: RUN 407
+; number of bins in Carlos's time to distance lookup table
 pdriftbins = 138
-
-; Time of first bin in ns.
-pdrift1stbin = -24
-
-; Bin size in ns.
-pdriftbinsz = 2
-
-; Drift time lookup tables - one for each plane.
-pwc1u1fract=0.0002,0.0005,0.0009,0.0011,0.0015,0.0018,0.0022,0.0027  ; TODO
-0.0029,0.0033,0.0038,0.0044,0.0048,0.0051,0.0057,0.0070,0.0090,0.0121
-0.0167,0.0217,0.0282,0.0371,0.0467,0.0582,0.0723,0.0873,0.1038,0.1211
-0.1409,0.1609,0.1826,0.2060,0.2302,0.2542,0.2796,0.3043,0.3294,0.3555
-0.3819,0.4085,0.4343,0.4618,0.4890,0.5140,0.5384,0.5635,0.5880,0.6100
-0.6311,0.6522,0.6722,0.6928,0.7120,0.7316,0.7495,0.7684,0.7853,0.8026
-0.8191,0.8334,0.8491,0.8629,0.8771,0.8888,0.8994,0.9089,0.9170,0.9242
-0.9308,0.9364,0.9411,0.9457,0.9496,0.9538,0.9571,0.9602,0.9630,0.9654
-0.9679,0.9698,0.9718,0.9735,0.9750,0.9765,0.9778,0.9791,0.9804,0.9815
-0.9825,0.9833,0.9844,0.9851,0.9855,0.9862,0.9870,0.9874,0.9877,0.9883
-0.9889,0.9893,0.9895,0.9898,0.9901,0.9904,0.9910,0.9918,0.9923,0.9927
-0.9930,0.9935,0.9937,0.9941,0.9943,0.9947,0.9949,0.9952,0.9957,0.9962
-0.9964,0.9966,0.9970,0.9973,0.9975,0.9977,0.9979,0.9982,0.9986,0.9988
-0.9990,0.9991,0.9994,0.9995,0.9998,0.9999,1.0000,1.0000,1.0000,1.0000
-
-pwc1x1fract=0.0004,0.0006,0.0008,0.0010,0.0012,0.0015,0.0017,0.0021  ; TODO
-0.0025,0.0028,0.0031,0.0033,0.0036,0.0041,0.0045,0.0051,0.0060,0.0075
-0.0104,0.0138,0.0191,0.0265,0.0356,0.0463,0.0596,0.0743,0.0916,0.1114
-0.1316,0.1533,0.1757,0.1988,0.2209,0.2455,0.2689,0.2945,0.3196,0.3437
-0.3697,0.3950,0.4196,0.4448,0.4702,0.4953,0.5186,0.5416,0.5650,0.5877
-0.6099,0.6316,0.6519,0.6719,0.6909,0.7099,0.7277,0.7463,0.7645,0.7821
-0.7979,0.8154,0.8320,0.8477,0.8612,0.8740,0.8865,0.8973,0.9077,0.9161
-0.9234,0.9301,0.9351,0.9406,0.9454,0.9497,0.9531,0.9570,0.9605,0.9631
-0.9660,0.9690,0.9713,0.9728,0.9748,0.9762,0.9775,0.9786,0.9800,0.9807
-0.9818,0.9827,0.9833,0.9843,0.9849,0.9857,0.9861,0.9866,0.9871,0.9877
-0.9883,0.9887,0.9891,0.9895,0.9898,0.9901,0.9907,0.9913,0.9916,0.9918
-0.9921,0.9925,0.9929,0.9931,0.9935,0.9940,0.9944,0.9946,0.9949,0.9952
-0.9956,0.9960,0.9966,0.9968,0.9970,0.9972,0.9974,0.9976,0.9979,0.9980
-0.9984,0.9985,0.9988,0.9990,0.9991,0.9993,0.9996,0.9998,0.9999,1.0000
-
-pwc1v1fract=0.0002,0.0006,0.0008,0.0011,0.0013,0.0016,0.0019,0.0020  ; TODO
-0.0022,0.0025,0.0030,0.0035,0.0038,0.0042,0.0049,0.0057,0.0076,0.0103
-0.0149,0.0200,0.0273,0.0353,0.0455,0.0574,0.0719,0.0865,0.1045,0.1224
-0.1416,0.1630,0.1844,0.2074,0.2317,0.2555,0.2807,0.3046,0.3298,0.3553
-0.3826,0.4075,0.4316,0.4563,0.4823,0.5065,0.5315,0.5554,0.5781,0.6014
-0.6235,0.6434,0.6643,0.6853,0.7050,0.7238,0.7415,0.7602,0.7787,0.7975
-0.8152,0.8307,0.8456,0.8595,0.8723,0.8851,0.8957,0.9043,0.9126,0.9205
-0.9276,0.9330,0.9383,0.9437,0.9484,0.9521,0.9553,0.9582,0.9607,0.9634
-0.9657,0.9676,0.9701,0.9722,0.9738,0.9755,0.9767,0.9781,0.9794,0.9804
-0.9814,0.9825,0.9835,0.9842,0.9847,0.9853,0.9861,0.9866,0.9871,0.9878
-0.9882,0.9888,0.9891,0.9897,0.9900,0.9903,0.9909,0.9910,0.9917,0.9919
-0.9924,0.9929,0.9937,0.9939,0.9944,0.9948,0.9954,0.9956,0.9961,0.9966
-0.9968,0.9972,0.9974,0.9978,0.9980,0.9981,0.9984,0.9986,0.9989,0.9991
-0.9995,0.9996,0.9998,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000
-
-pwc1u2fract=0.0003,0.0004,0.0008,0.0011,0.0015,0.0018,0.0021,0.0024  ; TODO
-0.0027,0.0030,0.0033,0.0037,0.0039,0.0043,0.0046,0.0049,0.0059,0.0073
-0.0094,0.0129,0.0184,0.0267,0.0352,0.0446,0.0563,0.0707,0.0863,0.1030
-0.1206,0.1411,0.1629,0.1845,0.2087,0.2325,0.2578,0.2837,0.3091,0.3357
-0.3606,0.3867,0.4119,0.4362,0.4608,0.4857,0.5099,0.5349,0.5587,0.5814
-0.6047,0.6260,0.6480,0.6685,0.6892,0.7099,0.7282,0.7456,0.7643,0.7812
-0.7988,0.8141,0.8309,0.8454,0.8616,0.8738,0.8847,0.8955,0.9049,0.9133
-0.9199,0.9274,0.9341,0.9399,0.9445,0.9489,0.9529,0.9561,0.9593,0.9620
-0.9645,0.9667,0.9689,0.9701,0.9720,0.9740,0.9756,0.9771,0.9785,0.9796
-0.9808,0.9816,0.9823,0.9832,0.9839,0.9846,0.9854,0.9860,0.9867,0.9874
-0.9876,0.9881,0.9885,0.9889,0.9895,0.9900,0.9902,0.9907,0.9910,0.9916
-0.9919,0.9923,0.9927,0.9930,0.9934,0.9937,0.9942,0.9945,0.9949,0.9953
-0.9957,0.9962,0.9965,0.9968,0.9971,0.9973,0.9976,0.9979,0.9981,0.9984
-0.9986,0.9988,0.9989,0.9993,0.9995,0.9998,0.9999,0.9999,1.0000,1.0000
-
-pwc1x2fract=0.0002,0.0005,0.0008,0.0011,0.0014,0.0017,0.0021,0.0025  ; TODO
-0.0027,0.0031,0.0032,0.0034,0.0040,0.0045,0.0052,0.0065,0.0083,0.0112
-0.0150,0.0200,0.0264,0.0341,0.0435,0.0560,0.0701,0.0862,0.1027,0.1210
-0.1417,0.1628,0.1833,0.2069,0.2301,0.2547,0.2799,0.3062,0.3314,0.3582
-0.3860,0.4141,0.4390,0.4656,0.4903,0.5161,0.5410,0.5649,0.5874,0.6090
-0.6298,0.6507,0.6721,0.6923,0.7117,0.7312,0.7510,0.7706,0.7881,0.8052
-0.8204,0.8360,0.8525,0.8666,0.8793,0.8906,0.9019,0.9103,0.9194,0.9274
-0.9340,0.9397,0.9442,0.9483,0.9523,0.9557,0.9596,0.9625,0.9653,0.9678
-0.9698,0.9718,0.9732,0.9751,0.9768,0.9782,0.9793,0.9804,0.9813,0.9821
-0.9828,0.9834,0.9842,0.9848,0.9852,0.9857,0.9861,0.9864,0.9872,0.9877
-0.9880,0.9886,0.9889,0.9894,0.9898,0.9903,0.9908,0.9915,0.9921,0.9924
-0.9927,0.9930,0.9935,0.9939,0.9943,0.9945,0.9949,0.9952,0.9957,0.9960
-0.9963,0.9965,0.9967,0.9972,0.9975,0.9979,0.9980,0.9985,0.9987,0.9988
-0.9990,0.9991,0.9992,0.9995,0.9997,1.0000,1.0000,1.0000,1.0000,1.0000
-
-pwc1v2fract=0.0004,0.0006,0.0008,0.0012,0.0013,0.0016,0.0018,0.0021  ; TODO
-0.0024,0.0027,0.0029,0.0032,0.0036,0.0039,0.0043,0.0049,0.0063,0.0080
-0.0113,0.0155,0.0218,0.0300,0.0397,0.0508,0.0645,0.0793,0.0949,0.1135
-0.1343,0.1560,0.1786,0.2019,0.2250,0.2498,0.2756,0.3011,0.3270,0.3526
-0.3778,0.4042,0.4299,0.4570,0.4821,0.5077,0.5311,0.5540,0.5784,0.6010
-0.6219,0.6429,0.6633,0.6830,0.7023,0.7214,0.7403,0.7590,0.7786,0.7948
-0.8118,0.8288,0.8444,0.8587,0.8725,0.8842,0.8946,0.9044,0.9136,0.9208
-0.9264,0.9323,0.9377,0.9428,0.9472,0.9506,0.9541,0.9576,0.9602,0.9635
-0.9656,0.9675,0.9695,0.9715,0.9732,0.9751,0.9768,0.9777,0.9789,0.9802
-0.9809,0.9819,0.9828,0.9835,0.9841,0.9850,0.9858,0.9863,0.9866,0.9870
-0.9875,0.9880,0.9884,0.9888,0.9894,0.9899,0.9901,0.9905,0.9909,0.9912
-0.9917,0.9919,0.9922,0.9926,0.9931,0.9936,0.9941,0.9945,0.9951,0.9954
-0.9959,0.9962,0.9964,0.9967,0.9969,0.9971,0.9975,0.9978,0.9980,0.9983
-0.9986,0.9988,0.9991,0.9995,0.9998,0.9999,0.9999,0.9999,1.0000,1.0000
-
-pwc2u1fract=0.0002,0.0005,0.0009,0.0011,0.0015,0.0018,0.0022,0.0027  ; TODO
-0.0029,0.0033,0.0038,0.0044,0.0048,0.0051,0.0057,0.0070,0.0090,0.0121
-0.0167,0.0217,0.0282,0.0371,0.0467,0.0582,0.0723,0.0873,0.1038,0.1211
-0.1409,0.1609,0.1826,0.2060,0.2302,0.2542,0.2796,0.3043,0.3294,0.3555
-0.3819,0.4085,0.4343,0.4618,0.4890,0.5140,0.5384,0.5635,0.5880,0.6100
-0.6311,0.6522,0.6722,0.6928,0.7120,0.7316,0.7495,0.7684,0.7853,0.8026
-0.8191,0.8334,0.8491,0.8629,0.8771,0.8888,0.8994,0.9089,0.9170,0.9242
-0.9308,0.9364,0.9411,0.9457,0.9496,0.9538,0.9571,0.9602,0.9630,0.9654
-0.9679,0.9698,0.9718,0.9735,0.9750,0.9765,0.9778,0.9791,0.9804,0.9815
-0.9825,0.9833,0.9844,0.9851,0.9855,0.9862,0.9870,0.9874,0.9877,0.9883
-0.9889,0.9893,0.9895,0.9898,0.9901,0.9904,0.9910,0.9918,0.9923,0.9927
-0.9930,0.9935,0.9937,0.9941,0.9943,0.9947,0.9949,0.9952,0.9957,0.9962
-0.9964,0.9966,0.9970,0.9973,0.9975,0.9977,0.9979,0.9982,0.9986,0.9988
-0.9990,0.9991,0.9994,0.9995,0.9998,0.9999,1.0000,1.0000,1.0000,1.0000
-
-pwc2x1fract=0.0004,0.0006,0.0008,0.0010,0.0012,0.0015,0.0017,0.0021  ; TODO
-0.0025,0.0028,0.0031,0.0033,0.0036,0.0041,0.0045,0.0051,0.0060,0.0075
-0.0104,0.0138,0.0191,0.0265,0.0356,0.0463,0.0596,0.0743,0.0916,0.1114
-0.1316,0.1533,0.1757,0.1988,0.2209,0.2455,0.2689,0.2945,0.3196,0.3437
-0.3697,0.3950,0.4196,0.4448,0.4702,0.4953,0.5186,0.5416,0.5650,0.5877
-0.6099,0.6316,0.6519,0.6719,0.6909,0.7099,0.7277,0.7463,0.7645,0.7821
-0.7979,0.8154,0.8320,0.8477,0.8612,0.8740,0.8865,0.8973,0.9077,0.9161
-0.9234,0.9301,0.9351,0.9406,0.9454,0.9497,0.9531,0.9570,0.9605,0.9631
-0.9660,0.9690,0.9713,0.9728,0.9748,0.9762,0.9775,0.9786,0.9800,0.9807
-0.9818,0.9827,0.9833,0.9843,0.9849,0.9857,0.9861,0.9866,0.9871,0.9877
-0.9883,0.9887,0.9891,0.9895,0.9898,0.9901,0.9907,0.9913,0.9916,0.9918
-0.9921,0.9925,0.9929,0.9931,0.9935,0.9940,0.9944,0.9946,0.9949,0.9952
-0.9956,0.9960,0.9966,0.9968,0.9970,0.9972,0.9974,0.9976,0.9979,0.9980
-0.9984,0.9985,0.9988,0.9990,0.9991,0.9993,0.9996,0.9998,0.9999,1.0000
-
-pwc2v1fract=0.0002,0.0006,0.0008,0.0011,0.0013,0.0016,0.0019,0.0020  ; TODO
-0.0022,0.0025,0.0030,0.0035,0.0038,0.0042,0.0049,0.0057,0.0076,0.0103
-0.0149,0.0200,0.0273,0.0353,0.0455,0.0574,0.0719,0.0865,0.1045,0.1224
-0.1416,0.1630,0.1844,0.2074,0.2317,0.2555,0.2807,0.3046,0.3298,0.3553
-0.3826,0.4075,0.4316,0.4563,0.4823,0.5065,0.5315,0.5554,0.5781,0.6014
-0.6235,0.6434,0.6643,0.6853,0.7050,0.7238,0.7415,0.7602,0.7787,0.7975
-0.8152,0.8307,0.8456,0.8595,0.8723,0.8851,0.8957,0.9043,0.9126,0.9205
-0.9276,0.9330,0.9383,0.9437,0.9484,0.9521,0.9553,0.9582,0.9607,0.9634
-0.9657,0.9676,0.9701,0.9722,0.9738,0.9755,0.9767,0.9781,0.9794,0.9804
-0.9814,0.9825,0.9835,0.9842,0.9847,0.9853,0.9861,0.9866,0.9871,0.9878
-0.9882,0.9888,0.9891,0.9897,0.9900,0.9903,0.9909,0.9910,0.9917,0.9919
-0.9924,0.9929,0.9937,0.9939,0.9944,0.9948,0.9954,0.9956,0.9961,0.9966
-0.9968,0.9972,0.9974,0.9978,0.9980,0.9981,0.9984,0.9986,0.9989,0.9991
-0.9995,0.9996,0.9998,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000
-
-pwc2u2fract=0.0003,0.0004,0.0008,0.0011,0.0015,0.0018,0.0021,0.0024  ; TODO
-0.0027,0.0030,0.0033,0.0037,0.0039,0.0043,0.0046,0.0049,0.0059,0.0073
-0.0094,0.0129,0.0184,0.0267,0.0352,0.0446,0.0563,0.0707,0.0863,0.1030
-0.1206,0.1411,0.1629,0.1845,0.2087,0.2325,0.2578,0.2837,0.3091,0.3357
-0.3606,0.3867,0.4119,0.4362,0.4608,0.4857,0.5099,0.5349,0.5587,0.5814
-0.6047,0.6260,0.6480,0.6685,0.6892,0.7099,0.7282,0.7456,0.7643,0.7812
-0.7988,0.8141,0.8309,0.8454,0.8616,0.8738,0.8847,0.8955,0.9049,0.9133
-0.9199,0.9274,0.9341,0.9399,0.9445,0.9489,0.9529,0.9561,0.9593,0.9620
-0.9645,0.9667,0.9689,0.9701,0.9720,0.9740,0.9756,0.9771,0.9785,0.9796
-0.9808,0.9816,0.9823,0.9832,0.9839,0.9846,0.9854,0.9860,0.9867,0.9874
-0.9876,0.9881,0.9885,0.9889,0.9895,0.9900,0.9902,0.9907,0.9910,0.9916
-0.9919,0.9923,0.9927,0.9930,0.9934,0.9937,0.9942,0.9945,0.9949,0.9953
-0.9957,0.9962,0.9965,0.9968,0.9971,0.9973,0.9976,0.9979,0.9981,0.9984
-0.9986,0.9988,0.9989,0.9993,0.9995,0.9998,0.9999,0.9999,1.0000,1.0000
-
-pwc2x2fract=0.0002,0.0005,0.0008,0.0011,0.0014,0.0017,0.0021,0.0025  ; TODO
-0.0027,0.0031,0.0032,0.0034,0.0040,0.0045,0.0052,0.0065,0.0083,0.0112
-0.0150,0.0200,0.0264,0.0341,0.0435,0.0560,0.0701,0.0862,0.1027,0.1210
-0.1417,0.1628,0.1833,0.2069,0.2301,0.2547,0.2799,0.3062,0.3314,0.3582
-0.3860,0.4141,0.4390,0.4656,0.4903,0.5161,0.5410,0.5649,0.5874,0.6090
-0.6298,0.6507,0.6721,0.6923,0.7117,0.7312,0.7510,0.7706,0.7881,0.8052
-0.8204,0.8360,0.8525,0.8666,0.8793,0.8906,0.9019,0.9103,0.9194,0.9274
-0.9340,0.9397,0.9442,0.9483,0.9523,0.9557,0.9596,0.9625,0.9653,0.9678
-0.9698,0.9718,0.9732,0.9751,0.9768,0.9782,0.9793,0.9804,0.9813,0.9821
-0.9828,0.9834,0.9842,0.9848,0.9852,0.9857,0.9861,0.9864,0.9872,0.9877
-0.9880,0.9886,0.9889,0.9894,0.9898,0.9903,0.9908,0.9915,0.9921,0.9924
-0.9927,0.9930,0.9935,0.9939,0.9943,0.9945,0.9949,0.9952,0.9957,0.9960
-0.9963,0.9965,0.9967,0.9972,0.9975,0.9979,0.9980,0.9985,0.9987,0.9988
-0.9990,0.9991,0.9992,0.9995,0.9997,1.0000,1.0000,1.0000,1.0000,1.0000
-
-pwc2v2fract=0.0004,0.0006,0.0008,0.0012,0.0013,0.0016,0.0018,0.0021  ; TODO
-0.0024,0.0027,0.0029,0.0032,0.0036,0.0039,0.0043,0.0049,0.0063,0.0080
-0.0113,0.0155,0.0218,0.0300,0.0397,0.0508,0.0645,0.0793,0.0949,0.1135
-0.1343,0.1560,0.1786,0.2019,0.2250,0.2498,0.2756,0.3011,0.3270,0.3526
-0.3778,0.4042,0.4299,0.4570,0.4821,0.5077,0.5311,0.5540,0.5784,0.6010
-0.6219,0.6429,0.6633,0.6830,0.7023,0.7214,0.7403,0.7590,0.7786,0.7948
-0.8118,0.8288,0.8444,0.8587,0.8725,0.8842,0.8946,0.9044,0.9136,0.9208
-0.9264,0.9323,0.9377,0.9428,0.9472,0.9506,0.9541,0.9576,0.9602,0.9635
-0.9656,0.9675,0.9695,0.9715,0.9732,0.9751,0.9768,0.9777,0.9789,0.9802
-0.9809,0.9819,0.9828,0.9835,0.9841,0.9850,0.9858,0.9863,0.9866,0.9870
-0.9875,0.9880,0.9884,0.9888,0.9894,0.9899,0.9901,0.9905,0.9909,0.9912
-0.9917,0.9919,0.9922,0.9926,0.9931,0.9936,0.9941,0.9945,0.9951,0.9954
-0.9959,0.9962,0.9964,0.9967,0.9969,0.9971,0.9975,0.9978,0.9980,0.9983
-0.9986,0.9988,0.9991,0.9995,0.9998,0.9999,0.9999,0.9999,1.0000,1.0000
+; number of 1st bin in Carlos's table in ns
+pdrift1stbin=0
+; bin size in ns
+pdriftbinsz=2
+pwc1u1fract=0.0011461,0.00317,0.00690,0.01254,0.02136,0.03390,0.04699,0.06279,0.08064
+0.10011,0.12101,0.14262,0.16523,0.18736,0.20951,0.23249,0.25508,0.27840,0.30111
+0.32387,0.34627,0.36927,0.39111,0.41228,0.43466,0.45617,0.47746,0.49859,0.52043
+0.54100,0.56202,0.58257,0.60260,0.62368,0.64388,0.66305,0.68197,0.70039,0.71804
+0.73704,0.75642,0.77314,0.79058,0.80744,0.82256,0.83784,0.85186,0.86603,0.87953
+0.89139,0.90225,0.91173,0.92065,0.92786,0.93411,0.94044,0.94563,0.95107,0.95532
+0.95903,0.96274,0.96605,0.96914,0.97212,0.97449,0.97712,0.97977,0.98200,0.98393
+0.98554,0.98721,0.98912,0.99069,0.99189,0.99275,0.99358,0.99460,0.99558,0.99629
+0.99671,0.99723,0.99777,0.99819,0.99852,0.99873,0.99910,0.99927,0.99937,0.99944
+0.99960,0.99965,0.99973,0.99979,0.99979,0.99979,0.99979,0.99979,0.99979,0.99979
+0.99981,0.99981,0.99981,0.99981,0.99983,0.99985,0.99985,0.99992,0.99992,0.99994
+0.99996,0.99998,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+pwc1u2fract=0.00127,0.00331,0.00710,0.01279,0.02256,0.03456,0.05006,0.06705,0.08468
+0.10465,0.12550,0.14656,0.16814,0.19095,0.21414,0.23722,0.26019,0.28225,0.30516
+0.32754,0.34884,0.37136,0.39396,0.41634,0.43779,0.45970,0.48114,0.50241,0.52286
+0.54459,0.56438,0.58579,0.60643,0.62612,0.64580,0.66538,0.68534,0.70383,0.72271
+0.74108,0.75768,0.77482,0.79195,0.80863,0.82467,0.83996,0.85435,0.86800,0.88131
+0.89337,0.90401,0.91439,0.92318,0.92995,0.93691,0.94238,0.94845,0.95301,0.95701
+0.96034,0.96353,0.96680,0.97030,0.97292,0.97569,0.97829,0.98086,0.98271,0.98477
+0.98648,0.98809,0.98963,0.99127,0.99242,0.99342,0.99421,0.99500,0.99596,0.99648
+0.99706,0.99756,0.99815,0.99854,0.99877,0.99904,0.99933,0.99946,0.99958,0.99965
+0.99975,0.99981,0.99983,0.99985,0.99988,0.99988,0.99988,0.99990,0.99994,0.99994
+0.99994,0.99994,0.99994,0.99994,0.99996,0.99996,0.99996,0.99998,0.99998,0.99998
+0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998
+0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998
+0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,1.00000,1.00000
+pwc1x1fract=0.00084,0.00302,0.00638,0.01286,0.02102,0.03056,0.04350,0.05795,0.07448
+0.09124,0.11099,0.13155,0.15424,0.17589,0.19869,0.22138,0.24357,0.26587,0.28858
+0.31069,0.33196,0.35402,0.37527,0.39649,0.41940,0.44249,0.46441,0.48754,0.50889
+0.52922,0.55059,0.57150,0.59245,0.61297,0.63390,0.65456,0.67354,0.69325,0.71205
+0.72962,0.74613,0.76400,0.78059,0.79747,0.81339,0.82877,0.84429,0.85790,0.87070
+0.88286,0.89393,0.90427,0.91266,0.92057,0.92793,0.93423,0.93991,0.94538,0.95061
+0.95430,0.95782,0.96170,0.96483,0.96757,0.97038,0.97309,0.97571,0.97844,0.98085
+0.98291,0.98490,0.98660,0.98815,0.98987,0.99102,0.99205,0.99316,0.99392,0.99486
+0.99566,0.99635,0.99671,0.99719,0.99761,0.99788,0.99822,0.99853,0.99889,0.99908
+0.99929,0.99943,0.99954,0.99960,0.99964,0.99973,0.99981,0.99981,0.99983,0.99985
+0.99985,0.99987,0.99987,0.99990,0.99992,0.99992,0.99994,0.99994,0.99996,0.99996
+0.99996,0.99996,0.99996,0.99996,0.99996,0.99998,0.99998,0.99998,0.99998,0.99998
+0.99998,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+pwc1x2fract=0.00113,0.00332,0.00674,0.01204,0.01948,0.02970,0.04162,0.05732,0.07433
+0.09304,0.11287,0.13326,0.15491,0.17725,0.19875,0.22163,0.24386,0.26582,0.28932
+0.31162,0.33331,0.35504,0.37574,0.39772,0.42035,0.44254,0.46348,0.48571,0.50657
+0.52788,0.54900,0.56915,0.58898,0.60797,0.62806,0.64772,0.66640,0.68481,0.70302
+0.72191,0.73915,0.75566,0.77290,0.78981,0.80645,0.82221,0.83701,0.85164,0.86507
+0.87759,0.88880,0.90011,0.90951,0.91794,0.92527,0.93220,0.93832,0.94376,0.94823
+0.95195,0.95572,0.95959,0.96268,0.96606,0.96919,0.97209,0.97464,0.97714,0.97931
+0.98123,0.98368,0.98530,0.98710,0.98862,0.99021,0.99127,0.99230,0.99317,0.99418
+0.99480,0.99549,0.99616,0.99670,0.99729,0.99764,0.99810,0.99839,0.99864,0.99887
+0.99902,0.99914,0.99923,0.99931,0.99935,0.99937,0.99939,0.99939,0.99946,0.99950
+0.99956,0.99960,0.99962,0.99962,0.99971,0.99975,0.99981,0.99987,0.99992,0.99994
+0.99994,0.99996,0.99996,0.99996,0.99996,0.99996,0.99998,0.99998,0.99998,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+pwc1v1fract=0.00077,0.00209,0.00420,0.00836,0.01424,0.02304,0.03247,0.04524,0.05917
+0.07543,0.09333,0.11271,0.13213,0.15260,0.17474,0.19765,0.22134,0.24477,0.26716
+0.28930,0.31121,0.33350,0.35621,0.37640,0.39980,0.42164,0.44341,0.46611,0.48762
+0.50962,0.53092,0.55227,0.57347,0.59253,0.61300,0.63276,0.65268,0.67194,0.69019
+0.70785,0.72589,0.74331,0.76150,0.77837,0.79604,0.81193,0.82783,0.84291,0.85715
+0.86959,0.88271,0.89336,0.90383,0.91341,0.92204,0.92955,0.93573,0.94150,0.94727
+0.95169,0.95547,0.95907,0.96274,0.96590,0.96902,0.97188,0.97468,0.97717,0.97985
+0.98183,0.98409,0.98585,0.98733,0.98877,0.99017,0.99172,0.99281,0.99400,0.99479
+0.99565,0.99634,0.99674,0.99703,0.99743,0.99778,0.99812,0.99835,0.99868,0.99902
+0.99925,0.99939,0.99950,0.99950,0.99952,0.99958,0.99962,0.99967,0.99969,0.99977
+0.99979,0.99981,0.99981,0.99983,0.99985,0.99985,0.99990,0.99990,0.99992,0.99996
+0.99996,0.99996,0.99996,0.99996,0.99996,0.99996,0.99996,0.99996,0.99996,0.99996
+0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998
+0.99998,0.99998,0.99998,0.99998,1.00000,1.00000,1.00000,1.00000,1.00000
+pwc1v2fract=0.00085,0.00249,0.00504,0.00942,0.01714,0.02640,0.03742,0.05064,0.06623
+0.08383,0.10350,0.12509,0.14709,0.16950,0.19254,0.21535,0.23741,0.26089,0.28266
+0.30557,0.32730,0.35123,0.37306,0.39461,0.41621,0.43861,0.46050,0.48284,0.50419
+0.52549,0.54701,0.56814,0.58931,0.61006,0.62997,0.64970,0.66869,0.68698,0.70574
+0.72446,0.74160,0.75891,0.77620,0.79281,0.80862,0.82413,0.83946,0.85362,0.86686
+0.87935,0.89122,0.90216,0.91127,0.92063,0.92786,0.93348,0.93913,0.94434,0.94932
+0.95380,0.95760,0.96071,0.96385,0.96725,0.97024,0.97300,0.97582,0.97835,0.98053
+0.98284,0.98443,0.98599,0.98769,0.98950,0.99074,0.99182,0.99290,0.99398,0.99446
+0.99550,0.99610,0.99682,0.99728,0.99768,0.99811,0.99836,0.99859,0.99878,0.99892
+0.99915,0.99921,0.99934,0.99946,0.99961,0.99961,0.99963,0.99975,0.99977,0.99981
+0.99985,0.99985,0.99990,0.99990,0.99992,0.99992,0.99992,0.99994,0.99994,0.99994
+0.99994,0.99996,0.99996,0.99996,0.99996,0.99996,0.99996,0.99996,0.99998,0.99998
+0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,1.00000,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+pwc2v2fract=0.00129,0.00346,0.00736,0.01307,0.02121,0.03166,0.04446,0.06031,0.07829
+0.09779,0.11941,0.14128,0.16459,0.18914,0.21232,0.23520,0.25936,0.28268,0.30550
+0.32828,0.35158,0.37350,0.39517,0.41699,0.43893,0.46012,0.48101,0.50190,0.52294
+0.54444,0.56432,0.58482,0.60410,0.62328,0.64206,0.66127,0.67956,0.69745,0.71394
+0.73107,0.74715,0.76363,0.77922,0.79396,0.80918,0.82319,0.83655,0.84989,0.86167
+0.87272,0.88359,0.89330,0.90240,0.91032,0.91799,0.92465,0.93048,0.93568,0.94035
+0.94456,0.94831,0.95240,0.95586,0.95930,0.96235,0.96556,0.96818,0.97069,0.97295
+0.97512,0.97729,0.97930,0.98121,0.98301,0.98489,0.98651,0.98784,0.98917,0.99045
+0.99143,0.99254,0.99348,0.99422,0.99482,0.99542,0.99606,0.99657,0.99696,0.99743
+0.99776,0.99808,0.99844,0.99867,0.99883,0.99901,0.99913,0.99935,0.99948,0.99958
+0.99965,0.99969,0.99972,0.99977,0.99981,0.99982,0.99984,0.99985,0.99989,0.99991
+0.99994,0.99994,0.99994,0.99995,0.99995,0.99995,0.99998,0.99999,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+pwc2v1fract=0.00151,0.00409,0.00751,0.01309,0.02108,0.03163,0.04409,0.05983,0.07802
+0.09868,0.11948,0.14150,0.16342,0.18636,0.20996,0.23344,0.25601,0.28046,0.30303
+0.32570,0.34779,0.36990,0.39226,0.41446,0.43568,0.45718,0.47814,0.49937,0.52082
+0.54142,0.56148,0.58173,0.60162,0.62151,0.64079,0.65960,0.67791,0.69506,0.71241
+0.72987,0.74655,0.76276,0.77851,0.79359,0.80854,0.82258,0.83580,0.84910,0.86151
+0.87331,0.88440,0.89438,0.90303,0.91114,0.91866,0.92503,0.93099,0.93689,0.94189
+0.94638,0.95009,0.95404,0.95767,0.96100,0.96421,0.96683,0.96938,0.97196,0.97453
+0.97684,0.97904,0.98105,0.98310,0.98485,0.98650,0.98813,0.98936,0.99054,0.99159
+0.99262,0.99344,0.99418,0.99473,0.99535,0.99589,0.99649,0.99690,0.99736,0.99770
+0.99805,0.99841,0.99862,0.99887,0.99910,0.99922,0.99937,0.99946,0.99955,0.99960
+0.99968,0.99974,0.99982,0.99983,0.99985,0.99988,0.99991,0.99993,0.99994,0.99995
+0.99995,0.99995,0.99995,0.99995,0.99995,0.99995,0.99997,0.99998,0.99998,0.99998
+0.99998,0.99998,0.99998,0.99999,0.99999,0.99999,0.99999,1.00000,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+pwc2x2fract=0.00106,0.00308,0.00661,0.01240,0.02065,0.03143,0.04496,0.06075,0.07973
+0.09960,0.12036,0.14274,0.16459,0.18694,0.21036,0.23369,0.25669,0.27982,0.30305
+0.32566,0.34828,0.37059,0.39291,0.41481,0.43674,0.45780,0.47902,0.49957,0.52029
+0.54063,0.56150,0.58144,0.60200,0.62122,0.64008,0.65844,0.67652,0.69464,0.71179
+0.72867,0.74540,0.76121,0.77709,0.79198,0.80619,0.81972,0.83381,0.84712,0.85866
+0.86992,0.88061,0.89113,0.90060,0.90905,0.91682,0.92346,0.92920,0.93469,0.93947
+0.94421,0.94841,0.95255,0.95586,0.95923,0.96257,0.96544,0.96849,0.97123,0.97391
+0.97604,0.97848,0.98086,0.98271,0.98429,0.98590,0.98738,0.98881,0.99006,0.99116
+0.99213,0.99328,0.99398,0.99453,0.99526,0.99573,0.99636,0.99692,0.99743,0.99779
+0.99818,0.99841,0.99873,0.99889,0.99903,0.99915,0.99938,0.99947,0.99955,0.99961
+0.99964,0.99970,0.99973,0.99976,0.99982,0.99990,0.99992,0.99993,0.99994,0.99994
+0.99994,0.99994,0.99997,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998
+0.99999,0.99999,0.99999,0.99999,0.99999,0.99999,0.99999,0.99999,0.99999,0.99999
+0.99999,0.99999,0.99999,0.99999,0.99999,1.00000,1.00000,1.00000,1.00000
+pwc2x1fract=0.00116,0.00370,0.00754,0.01342,0.02193,0.03240,0.04531,0.06106,0.07885
+0.09810,0.11859,0.13933,0.16093,0.18304,0.20545,0.22803,0.25136,0.27275,0.29579
+0.31763,0.34016,0.36200,0.38434,0.40605,0.42779,0.44961,0.47077,0.49155,0.51315
+0.53547,0.55559,0.57546,0.59568,0.61585,0.63443,0.65431,0.67326,0.69175,0.70880
+0.72585,0.74264,0.75896,0.77535,0.79110,0.80641,0.82056,0.83491,0.84831,0.86070
+0.87282,0.88359,0.89290,0.90199,0.91032,0.91777,0.92420,0.93055,0.93612,0.94105
+0.94526,0.94999,0.95374,0.95733,0.96066,0.96390,0.96680,0.96993,0.97240,0.97496
+0.97703,0.97921,0.98124,0.98325,0.98528,0.98690,0.98840,0.98980,0.99110,0.99215
+0.99321,0.99392,0.99467,0.99545,0.99595,0.99649,0.99697,0.99739,0.99769,0.99800
+0.99821,0.99849,0.99865,0.99885,0.99901,0.99916,0.99924,0.99931,0.99939,0.99949
+0.99953,0.99957,0.99962,0.99966,0.99969,0.99970,0.99973,0.99974,0.99976,0.99978
+0.99980,0.99982,0.99984,0.99985,0.99985,0.99985,0.99987,0.99987,0.99989,0.99989
+0.99989,0.99991,0.99993,0.99997,0.99998,0.99999,0.99999,1.00000,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+pwc2u2fract=0.00104,0.00279,0.00627,0.01174,0.01933,0.03030,0.04376,0.05926,0.07656
+0.09536,0.11612,0.13794,0.15975,0.18226,0.20448,0.22720,0.24993,0.27299,0.29525
+0.31742,0.33957,0.36299,0.38580,0.40726,0.42998,0.45127,0.47292,0.49455,0.51656
+0.53732,0.55858,0.58008,0.60046,0.62093,0.63978,0.65816,0.67704,0.69550,0.71338
+0.73108,0.74871,0.76498,0.78141,0.79789,0.81301,0.82768,0.84136,0.85465,0.86717
+0.87844,0.88989,0.89978,0.90818,0.91610,0.92269,0.92928,0.93495,0.94002,0.94474
+0.94915,0.95299,0.95700,0.96077,0.96398,0.96708,0.96979,0.97241,0.97466,0.97728
+0.97936,0.98165,0.98355,0.98522,0.98675,0.98816,0.98969,0.99081,0.99175,0.99283
+0.99369,0.99449,0.99534,0.99599,0.99661,0.99716,0.99758,0.99790,0.99828,0.99856
+0.99870,0.99899,0.99917,0.99926,0.99945,0.99952,0.99956,0.99963,0.99970,0.99972
+0.99978,0.99981,0.99982,0.99986,0.99990,0.99990,0.99992,0.99992,0.99992,0.99993
+0.99994,0.99994,0.99994,0.99996,0.99996,0.99996,0.99997,0.99997,0.99997,0.99997
+0.99997,0.99997,0.99997,0.99998,0.99999,0.99999,1.00000,1.00000,1.00000,1.00000
+1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000,1.00000
+pwc2u1fract=0.00099,0.00312,0.00671,0.01222,0.02005,0.03014,0.04237,0.05699,0.07340
+0.09132,0.11127,0.13169,0.15355,0.17524,0.19902,0.22079,0.24265,0.26520,0.28736
+0.30977,0.33246,0.35498,0.37819,0.40009,0.42235,0.44440,0.46651,0.48765,0.50936
+0.53129,0.55175,0.57237,0.59240,0.61234,0.63137,0.65098,0.66954,0.68778,0.70644
+0.72442,0.74206,0.75913,0.77532,0.79132,0.80682,0.82179,0.83666,0.85070,0.86396
+0.87662,0.88753,0.89781,0.90770,0.91625,0.92374,0.93025,0.93616,0.94196,0.94722
+0.95167,0.95587,0.95942,0.96276,0.96613,0.96920,0.97200,0.97453,0.97698,0.97929
+0.98148,0.98333,0.98512,0.98695,0.98858,0.99012,0.99151,0.99258,0.99359,0.99443
+0.99531,0.99605,0.99669,0.99728,0.99761,0.99793,0.99811,0.99846,0.99863,0.99883
+0.99902,0.99917,0.99924,0.99935,0.99943,0.99951,0.99957,0.99963,0.99964,0.99968
+0.99969,0.99973,0.99976,0.99978,0.99979,0.99981,0.99983,0.99983,0.99984,0.99985
+0.99986,0.99989,0.99989,0.99991,0.99992,0.99992,0.99993,0.99996,0.99996,0.99996
+0.99996,0.99996,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99998,0.99999
+0.99999,0.99999,0.99999,0.99999,1.00000,1.00000,1.00000,1.00000,1.00000