Skip to content
Snippets Groups Projects
Commit 1364227c authored by Carlos Yero's avatar Carlos Yero
Browse files

modified script to produce 'new_tzero.param' containing only the HMS DC time offsets.

These offsets need to be copied to the hdc_tracking.param file before re-running the
hms replay script.
parent 4b36b0bd
No related branches found
No related tags found
No related merge requests found
......@@ -4,12 +4,12 @@
void update_hdcparam()
{
//read run number from input file
int run_NUM;
TString f0 = "input_RUN.txt";
ifstream infile(f0);
infile >> run_NUM;
infile >> run_NUM;
TString run = Form("run%d", run_NUM);
......@@ -20,92 +20,59 @@ void update_hdcparam()
//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
if (id != '#') //skip comments
{
//count lines
//count lines
lin_NUM = lin_NUM + 1;
cout << lin_NUM << endl;
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 hdc.param parameter file
TString hdc_param = "../../../PARAM/HMS/DC/hdc_new.param";
ofstream ofs(hdc_param);
ofs << ";---------------------------------------------------------------------" << endl;
ofs <<"; HMS_TRACKING"<< endl;
ofs <<"; CTP parameter file containing all tracking parameters for the HMS "<< endl;
ofs <<";----------------------------------------------------------------------"<< endl;
ofs <<"; sigma of wire chamber resolution for each plane "<< endl;
ofs <<" hdc_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 <<" hdc_tdc_min_win = -25000,-25000,-25000,-25000,-25000,-25000 "<< endl;
ofs <<" -25000,-25000,-25000,-25000,-25000,-25000 "<< endl;
ofs <<" hdc_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 <<" hdc_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 <<"hdc_plane_time_zero = ";
//*****************************************************************
//output all t_0 corrected values to hdc.param
for (int i=0; i<12; i++) {
//Update hdc.param parameter file
TString new_tzero = "../../../PARAM/HMS/DC/new_tzero.param";
ofstream ofs(new_tzero);
//output all t_0 corrected values to hdc.param
for (int i=0; i<12; i++) {
{
if (i < = 5){
ofs << time_shift - tzero[i] << ",";
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] << ",";
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 <<"hdc_wire_velocity = 12.0 "<< endl;
ofs <<"hdc_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++)
for (int i=0; i<12; i++)
{
ofs << tzero[i] << endl;
ofs << tzero[i] << endl;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment